I have made a program in which three jframe is exist. But the problem is that when I close one jframe all the remaining opening jframe is also closed. Please help me.
Asked
Active
Viewed 109 times
0
-
1[First search on google](https://stackoverflow.com/questions/1944446/close-one-jframe-without-closing-another). Try to search before asking. – Deggo Aug 09 '17 at 06:25
-
See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) – Andrew Thompson Aug 09 '17 at 07:14
3 Answers
2
If you do not want your application to terminate when a JFrame is closed, use
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

Adeel
- 413
- 1
- 7
- 22
0
It may be specific need for your project to create 3 JFrames but it is a good GUI making practice, to create only a single JFrame.
For additional windows, which you want to open from parent JFrame, you can easily use JDialogs which offers more functionalities over opening a new child JFrame. :-)

Aman
- 735
- 1
- 6
- 19
-
-
-
Andrew I think you are the right person to ask. Can u please help me with my question "Arial Unicode MS Not Working With Jtree"?? – Aman Aug 09 '17 at 07:23
-1
You can Use jframe.dispose() function or if you use NetBeans then you find a option in project properties the defaultCloseOperation tab then select Dispose from drop Down Menu

Arm Avi
- 21
- 1
- 1
- 3