I have small standalone GUI application, which contains four screens. The flow goes from one screen to next screen by pushing a JButton on each screen. Here is the design. Here are the classes I have: Main.java Main extends JFrame { public static void main(String[] args) { } } FirstScreen.java FirstScreen extends JPanel { FirstScreen(Main parent) {} } SecondScreen.java SecondScreen extends JPanel { FirstScreen(Main parent) {} } .... and so on Each Screen is shown by attaching to the Main. Problem: When I go from FirstScreen to SecondScreen, somehow even is not visible( though it is captured behind the screen) on the SecondScreen. Meaning for every action to be visible on the second screen, I have to refresh the screen by minimizing/maximizing it OR by hiding with some other window. To make it more clear say, If I click a JButton on the SecondScreen, ThirdScreen is not visible. However if I minimize it and maximize again it is visible. It seems to be some issue with the setting the Visibility for the Frame & JPanel. Can some one help me how do I have to set the visibility for the screens OR is there any better design ? Whenever I want to show a screen, I do this: setVisible(false) (for currentScreen) setVisible(false) (for Main ) setVisible(true) (for the new Screen) setVisible(true) (for Main)
John Zukowski Author of <a href="http://www.amazon.com/exec/obidos/ASIN/189311578X/ref=ase_electricporkchop/107-7882751-0234939" target="_blank" rel="nofollow">"Definitive Guide to Swing for Java 2"</a>,<br /><a href="http://www.amazon.com/exec/obidos/ASIN/1893115925/ref%3Dase%5Felectricporkchop/102-5437230-7785719" target="_blank" rel="nofollow">"Java Collections"</a> and <a href="http://www.amazon.com/exec/obidos/ASIN/1893115984/ref%3Dase%5Felectricporkchop/102-5437230-7785719" target="_blank" rel="nofollow">"Learn Java with JBuilder 6"</a>