The JPanel did not show when the menu is selected

My program consists a JMenu bar with sub menu items. When the user select on the menu items a panel with the gridbag layout will show with all the labels.but the panel did not show. Can anyone show the problem for me ?
AdminFrameMain.java
public class AdminFrameMain
     private DisplayMenuBar menubar;
     private DisplayToolBar toolbar;
     private DisplayStatusBar statusbar;     
     public AdminFrameMain()
          JFrame frame = new JFrame("S-League Administration Management System");
          Toolkit kit = frame.getToolkit();
          Dimension windowsize =kit.getScreenSize();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          Container content = frame.getContentPane();
          content.setLayout(new BorderLayout());
          menubar = new DisplayMenuBar(frame,content);
          toolbar = new DisplayToolBar(content);
          statusbar = new DisplayStatusBar(content);
          frame.setSize(800,600);
          frame.setVisible(true);
     public static void main(String [] args){
          AdminFrameMain tm = new AdminFrameMain();
DisplayMenuBar.java
public class DisplayMenuBar
     private JMenu addMenu,addTeamMenu;
     private JMenuBar bar = new JMenuBar();
     private JToolBar toolbar = new JToolBar();
     private JMenuItem addTeamItem;
     private JFrame setFrame;
     private Container setContent;
     private AddTeamManagement addTeamMang;
     public DisplayMenuBar(JFrame frame,Container c)
          setFrame = frame;
          setContent = c;
          SetMenuBar();
     public void SetMenuBar()
     setFrame.setJMenuBar(bar);
     addMenu = new JMenu("Add");
     //file menu items list
     //Add sub menu
     addTeamMenu = new JMenu("Team Management");
     addMenu.add(addTeamMenu);
     //Add sub menu items
     addTeamMenu.add(addTeamItem = new JMenuItem("Add Team"));
     addTeamMenu.setMnemonic('T');     
     addTeamItem.setMnemonic('T');
     //team items listener
     //addTeamItem.addActionListener(taskcommand);          
     addTeamItem.addActionListener(new ActionListener()
          public void actionPerformed(ActionEvent e)
               AddTeamManagement addTeamMang = new AddTeamManagement(setFrame,setContent);
     bar.add(addMenu);
AddTeamManagement.java
public class AddTeamManagement
     private JPanel addTeamPanel;
     private JFrame frame;
     private JButton createTeamBt,resetTeamBt;
     private Container addTeamContent;
     private JTextArea teamDescTextArea,teamIndpTextArea;
     private JTextField teamNameField;
     private JLabel teamID,teamDesc,teamInfo,numOfPlayers,teamZone,playersNum;
     private GridBagLayout gridBag;
     private GridBagConstraints constraints;
     public AddTeamManagement(JFrame f,Container c)
          System.out.println("add team mg");
          addTeamPanel = new JPanel();
          frame = f;
          addTeamContent = c;
          gridBag = new GridBagLayout();
          addTeamPanel.setLayout(gridBag);
          addTeamPanel.setBackground(Color.pink);
          constraints = new GridBagConstraints();
          teamID = new JLabel("Team ID:");
          teamDesc = new JLabel("Team Description:");
          teamInfo = new JLabel("Team Info:");
          numOfPlayers = new JLabel("No Of Players:");
          playersNum = new JLabel("15 Maximun");
          teamZone = new JLabel("Team Zone:");
          constraints.fill = constraints.VERTICAL;
          constraints.weightx = 1;
          constraints.weighty = 0;
          addComponent(teamID,0,0,1,1);
          constraints.fill = constraints.VERTICAL;
          constraints.weightx = 1;
          constraints.weighty = 0;
          addComponent(teamDesc,1,0,1,1);
          constraints.fill = constraints.VERTICAL;
          constraints.weightx = 1;
          constraints.weighty = 0;
          addComponent(teamInfo,2,0,1,1);
          constraints.fill = constraints.VERTICAL;
          constraints.weightx = 1;
          constraints.weighty = 0;
          addComponent(numOfPlayers,3,0,1,1);
          constraints.fill = constraints.VERTICAL;
          constraints.weightx = 1;
          constraints.weighty = 0;
          addComponent(teamZone,4,0,1,1);
          System.out.println("showing");
          addTeamContent.add(addTeamPanel,BorderLayout.CENTER);
     public void addComponent(Component component,int row,int column,int width,int height)
          System.out.println("adding c");
          constraints.gridx = column;
          constraints.gridy = row;
          constraints.gridwidth = width;
          constraints.gridheight = height;
          gridBag.setConstraints(component,constraints);
          addTeamPanel.add(component);
          addTeamPanel.setVisible(true);
}

Hello,
you are missing only one link, just add following line to your actionPerformed method of DisplayMenuBar class and all problem will be solved
setContent.validate();
Actually, Swing component does not updated automatically. when you do any changes to the component layout it will set that component as invalidated component. To update the view you need to call validate() method defined in JComponent class.
Virus

Similar Messages

  • Yours sincerely! I just bought a Sony DCR-SD1000 camera only when installing the cd drivers not supported by the operating system Machintosh. I've contacted the seller said the store did not provide for the apple os. How can I move all the files on the ca

    Yours sincerely! I just bought a Sony DCR-SD1000 camera only when installing the cd drivers not supported by the operating system Machintosh. I've contacted the seller said the store did not provide for the apple os. How can I move all the files on the camera the port out is to use a USB data cable to a laptop for my macbookpro can not read the contents of the file and the camera. I also want to use the lens on the camera as a substitute for the embedded camera on my macbookpro, what should I do to replace the embedded camera on macbookpro with sony camera so that the camera could be more variety and can I record when I turned macbookpro . Please help for this so that I can quickly capture the results from sony camera to my macbookpro. Thank you.

    See this page http://macosx.com/forums/networking-compatibility/296947-sony-camcorder-my-mac.h tml - might be some helpful tips there.
    Clinton

  • Need to send my back up email a reset security questions email but the option does not show when I click on password and security

    Need to send my back up email a reset security questions email but the option does not show when I click on password and security

    You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
    (97456)

  • I cannot unlock my phone. When I hit the number the key is highlighted but the "dot" does not show in the passcode box. Have shut it off and restarted nothing. Held on/off and "square" key to reset but still nothing. Any ideas on how to resolve this issue

    I cannot unlock my phone. When I hit the number the key is highlighted but the "dot" does not show in the passcode box. Have shut it off and restarted nothing. Held on/off and "square" key to reset but still nothing. Any ideas on how to resolve this issue

    Connect to iTunes and try to reset it from there.

  • My home button is not working sometimes and at the store they dont want to take it for repair because the problem did not show up at that time

    My home button is not working sometimes and at the store they dont want to take it for repair because the problem did not show up at that time

    When normally powering the phone, there would not be a loading bar, you would just see the Apple logo. You can try a reset of the phone, hold the sleep/wake and home buttons together until you see the Apple logo and then release. The phone will reboot.
    You can take the phone to Apple, by making an appointment at the Genius Bar to have the hardware checked. Apple handles warranty and post-warranty issues, not Verizon. Have Apple look at the hardware to see if there are any problems.

  • Hi i just wanna ask about the volume down button in the ipad 2 ,it was mute the device when hold it at once but before 2days i noticed that the device did not mute when i hold it ,why? and how i fix this by the way it is still volume down

    hi i just wanna ask about the volume down button in the ipad 2 ,it was mute the device when hold it at once but before 2days i noticed that the device did not mute when i hold it ,why? and how i fix this by the way it is still volume down

    Have you tried restarting or rebooting the iPad and then see if the volume control will work again?
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • TS1410 My iPod shuffle ( 1st or 2nd generation) will not recharge and does not show when the doc is connected to my MacBook Pro. I'm running the latest updated version of iTunes.

    My iPod shuffle ( 1st or 2nd generation) will not recharge and does not show when the doc is connected to my MacBook Pro. I'm running the latest updated version of iTunes.

    Hello Jane Benstock,
    Thank you for using Apple Support Communities
    It sounds like the next best step to take would be to reset the iPod Shuffle.
    Check out this article named Resetting iPod shuffle found here http://support.apple.com/kb/HT1655.
    All the best,
    Sterling

  • Windows Server 2012 Foundation, in a Workgroup - "The server did not finish checking the license compliance. If the server is joined to a domain, make sure that the server can connect to a domain controller"...

    Every few days we see two dialogs with the following messages:
    Dialog 1, title: Check for Licensing Compliance is Incomplete
    The server did not finish checking the license compliance. If the server is joined to a domain, make sure that the server can connect to a domain controller.
    Dialog 2, title: Check for Licensing Compliance is Incomplete
    The server did not finish checking the license compliance. If the server is joined to a domain, make sure that the server can connect to a domain controller. If the license compliance check cannot be completed, the server will automatically shut
    down in 8 day(s) 23 hour(s) 0 minute(s).
    The server is not (and never has been) joined to a domain or had any DC roles installed. In fact its still connected to the default Workgroup.
    The server was configured in our office and never showed this message until it was installed on site. The main difference from what I can see is that when installed on site it was given a static IP address and does not have any DNS settings in the network
    adapter properties. 
    I have scoured a number of forums on this error but in almost every other instance of this error message the servers are connected to a Domain Controller and the solutions generally are linked to dis-joining and rejoining the domain. Unfortunately this is
    not an option for this scenario.
    I initially thought that adding some relevant DNS server IP address may resolve the issue, however, we have the exact same model server configured exactly the same running at a different site that does not experience this problem. This server also has no
    DNS server configured.
    I have seen a post that suggests turning off the servers "Foundation Checking", but I'm unsure how to do this.

    Thanks for your response Vivian.
    I can confirm that this server is not (and never has been) a member of any active directory, it is configured as a Workgroup server. It was initially configured on a network that does have an active directory, but was never joined to it. During that time it
    never displayed these messages.
    The server was moved into production on a different site and network and setup with a static IP address.The site network does have its own active directory but the server was not joined to it. It is whilst on this new network that these messages began.
    Since my original post DNS servers have been added and the Microsoft activation has been verified, however, the messages are still appearing.
    There are only 2 user accounts configured on this server. The local admin account and another local admin user.
    The remote desktop services roles have been installed but not yet configured. I don't think that has any bearing on this scenario though.
    The description of this error in the above "Introduction to Windows Server 2012 Foundation" link states:
    This error occurs when the server cannot finish checking the requirements for the root domain, forest trust configuration, or both. It usually happens when the server cannot connect to a domain controller. If the situation persists, the server will
    shut down 10 days after the first time the compliance check failed. Each time this error message occurs, it will state the actual time remaining before the server will shut down. If you restart the server after it has shut down because of non-compliance, the
    server will shut itself down again in 3 days.
    The above description leads me to the following question - In a Workgroup environment, does the server still try to contact a domain controller to establish a level of trust? If this is the case could it be that the server can no longer see the initial DC
    on its new network and this is what is triggering the messages?
    Am I clutching at straws here?

  • ID 53 Details: The service did not respond to the start or control request in a timely fashion (0x8007041D))

    One of my clients has his dpm server turned off for a long time. Now when that server is back online I cannot re-sync backup. First was database in suspect mode and I was not able to acess dpm console. Now when I fix that I cant re-sync job. I even tried
    to delete on PG and recreate it but without success. Agent showing OK and it can comunicate with server. I have even tried to uninstall agent and re-install it but without luck.
    ID 53 Details: The service did not respond to the start or control request in a timely fashion (0x8007041D))
    That is the error what I get on all protection groups. Is there any one who can help with this?
    And last thing is that DPM is crushing on recovery tab

    Hi
    Do you still need assistance with this?

  • Payment from the customer is not showing in the lockbox transaction.

    Hi all,
    When i execute transaction code FLB1, I could not able to find lockbox and  customer did the payment  but it was not reflected in sap.
    Payment from the customer is not showing in the lockbox transaction.
    Please suggest and gide me with solution what could be the reason  i am not awear of lockbox process.
    Regards,
    JC
    Edited by: jcnaidu on Sep 17, 2010 6:41 AM

    The messages are getting to the recipient...
    I am on a Comcast IMAP server if this has anything to do with it and the server settings are following the correct server port numbers, SSL settings, etc... I save Sent messages on the IMAP server for 90 days.... None of these "disappearing" messages were on the server for more than a couple of days.. Typically, these messages will get 'hung' in the Outgoing Mailbox for @30 seconds before sending... like they are being scanned for viruses or Mail can't connect to the server all of a sudden...
    I anybody else here is on a Comcast IMAP server, and having this problem of disappearing Sent messages... This would tell us that it might be a Mail Provider issue with their outgoing server...
    --prd54usa

  • Make the emails do not show in the ipad or iPhone after i read them in my macbook air

    make the emails do not show in the ipad or iPhone after i read them in my macbook air

    Assuming you're using Apple's Mail on your Mac, go to your Mac's mail Preferences (from Mail on the menu bar).
    Click Accounts on top, then click your email account on the left.
    Then click Advanced on the top.
    Check "remove copy from server after retrieving a message" and set the line below it to "immediately".
    That will do it.

  • TS2972 why is the import button not showing at the button right hand corner of iTunes?

    why is the import button not showing at the bottom right hand corner of my ITunes page.  I am trying to transfer files from my home share library onto a new computers library.

    See if it isn't hidden under the View menu. iTunes- Turning on iTunes menus in Windows 8 and 7.

  • Prices for the characteristic is not showing in the webshop

    hi all,
    we are facing a strange issue.
    When we are trying to select configuration for the configurable product the prices are not showing in
    the webshop against each configaration option but when we press the accept button after selecting the configuration the prices are adding automatically to the total.
    our actual requirement is we have to show the prices against each configurable part of the configurable product in the webshop.
    Whether we have to implement any special IPC user exit for this ?
    there is already one standard implementation com.sap.spc.document.impl.userexit.csticValueSurcharge.StandardImplementation
    under the CVS type userexit with the std delivery.
    Note:we haven't done any custome development in this page of the webshop.
    Please help it is urgently needed
    Thanks and Regards
    shanto allor
    Edited by: shanto aloor on Mar 13, 2009 3:49 PM
    Edited by: shanto aloor on Mar 16, 2009 1:47 PM

    Hi Shanto,
    The business requirement you have can be managed by the field catalog.
    I think you will have to maintain the value of all possible combinations while you are selecting the characterstics.
    You will have to add a field to the field catalog at item level  and subsequently included this field in a condition table, access sequence and condition type.
    When attributes of field catalog are being passed to IPC, you need to populate this new field by writing a code in BADI   CRM_COND_COM_BADI.
    Then in the WEB UI the field can be accessed  using java code , i think this shud help you.
    Wish u gud luck for this assignment.

  • Windows Phone Emulator is unable to connect to the Windows Phone operating system: The phone did not respond to the connect request. Some functionality might be disabled

    We are receiving following error, while trying to deploy the application on Win Phone emulator. “Windows Phone Emulator is unable to connect to the Windows Phone operating system: The phone did not respond to the connect
    request. Some functionality might be disabled.”
    I have tried all possible ways that we found on blogs. We are still not able to solve this issue

    I have had a lot of issues with the emulator in the past.
    Check out this troubleshooting guide. It might help:
    https://msdn.microsoft.com/en-us/library/windows/apps/jj681694(v=vs.105).aspx
    Also, I find that if I cancel my build/deploy while it is stuck on booting the OS and then wait a short while the phone OS will complete booting, and from that point I can deploy to the emulator. It's a workaround, but it works well for me.
    I need to do that on Windows 10 tech preview, which may or may not be simply an incompatibility with the beta OS.
    I'm a self-taught noob amateur. Please take this into account when responding to my posts or when taking advice from me.

  • I changed my browser fill and the update does not show in the preview mode

    I changed my browser fill and the update does not show in the preview mode. I saved and restarted muse but the problem is still there. Any thing else I can do? Could it be something that changed in the file?

    Hello,
    What did you put in the "browser fill" area, an image or a color? WIth gradient or with solid color? Also, does it show fine if you "Preview in Browser"?
    Screenshots showing the Browser fill section (like this: http://screencast.com/t/RHqdVPP4) and the display in Preview mode would also be helpful.
    Cheers
    Parikshit

Maybe you are looking for

  • Custom scan(MpCmdRun) throws error 0x80508023

    Hi, On our server(Windows Server 2012) SCEP 2012 R2 is our protection against virusses. For a POC we have to scan each uploaded file explicitely using MpCmdRum.exe. 1) Within SCEP.. the automatic update is sheduled for every day; 2) The upload-direct

  • How to use third party APIs with Sun J2ME Toolkit

    I've installed Sun J2ME Toolkit 2.1. If I intend to use other third party APIs with my existing toolkit, how do I do that. I can manage to get the jar file of the associated API classes, but how to integrate the same with the toolkit. Thanks in advan

  • Mavericks upload issues

    I have upgraded my early 2009 Mac Pro, 2011 mini, 2012 mini, & my 2012 Macbook Air...  I can't upload anything via web browser on any of them.  This is amongst all of the other common issues emerging as a result of upgrading to Mac OS X 10.9 Maverick

  • Internet Explorer 10 language in SUP

    SCCM 2012 R2 CU3 Hello, i my OSD I am installing different languapacks for Windows and I switch the language Settings to the needed country. I saw, that IE10 remains in English and their is no Windowsupdate on my SUP which switch the IE to the needed

  • Importing a Flash Video created from a DVD file into a presentation

    We have a DVD recording that we converted to various formats, including SWF, AVI and FLA/FLV.  We want to use our LMS to track who has watched the video so we hoped to use a Capitvate Presentation and the SCORM feature.  I created a new presentation