When i m clicking on next another frame is open but i want
to hide the previous frame...........but it is not
happening....still both frame are visible........how to
make one frame to hide.......please help me.......
Answers were Sorted based on User's Feedback
Answer / romesh nongthombam
The best way to do in such condition is used the Card layout
so that you can easily process next previous function.
If you want to hide the frame, you can use like this
JFrame f1 = new JFrame("Frame 1");
JFrame f2 = new JFrame("Frame 2");
to hide f1, call f1.setVisible(false);
to show f2, call f2.setVisible(true);
| Is This Answer Correct ? | 34 Yes | 7 No |
Answer / guest
use the setVisible method to hide the frame.
i.e) this.setVisible(false);
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / doris
Hi, u can use this code snippet...
new MAIN_STORING().setVisible(true);
this.setVisible(false);
n/b: assuming that the keyword 'this' is pointing to the
one u want to go off when u click for MAIN_STORING page.
Goodluck!
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / deepak pawar
you can use the following statment
to yhe next button action listner
this.setVisible(false);
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / prerna keshari
You certainly don't want to destroy frame1, so do not use
despose(). just use setVisible() method and provide the
argument as false.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / guest
use the setVisible method to hide the frame.
i.e) this.setVisible(false);
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / vimal pratap singh
use this one for visible or not this.setVisible(false);
| Is This Answer Correct ? | 2 Yes | 3 No |
how can u handle runtime exceptions in java plz explain with examples briefly?
Does Swing contains any heavy weight component?
What are the features of JFC?
what is the diff's between swing and applet?
Why should the implementation of any swing callback (like a listener) execute quickly?
What method is used to specify a container's layout?
What is jfc? What are the features of jfc?
What is swing framework in java?
Which method is used by the applet to recognize the height and width?
What is the function of lightweight components used in swing?
What is sling swing?
What is import javax swing?