whats wrong with this swing code?
Posted on 2004-10-20
I've got a simple java application with a single JFrame as the top level container.
When the app starts up, the contentPane of the JFrame is set with:
where helpForm is a JPanel inside the objGuiPanels object.
I then have a series of menus, and the action on a menu button calls the following method. What i'm trying to do is replace
the JPanel that the app loads at startup with a JPanel that corresponds to the menu item that the user has clicked. In this code aboutSoftware is a class, and aboutSoftwarePanel is a public JPanel in it.
public void openHelpPage()
System.out.println("should change form");
// NOTE THIS METHOD IS CAUSING ERROR - THE CONTENT PANE ISnT CHANGING
// IT IS FREEZING UP AND NOT REPAINTING
The content pane doesn't change however - it sort of freezes and doesn't repaint itself. I can keep using the menus, so its not actually frozen, but the content pane stops repainting and it doesn't load the new JPanel.