Reputation: 1948
I am making a small application. From one JFrame, I am calling another JFrame. Now, I want this child JFrame to exist independently even after I've closed the parent JFrame. Is there any way I can do this? Or is this just NOT possible? Please help me. Let me know if you need me to post the code.
Thanks.
Upvotes: 2
Views: 969
Reputation: 47608
On each JFrame, set the default close operation with #setDefaultCloseOperation to the following:
When you press the close-button of the frame, it will only close it and the other will continue its life until it is closed.
Note: I would recommend to avoid multiple Frames and rather try to use Tabs, it provides a better user experience.
Upvotes: 5
Reputation: 4421
Yeah it is definitely possible, just make sure the original frame isn't set to exit the application on close.
The second frame exists independently from the first, and you don't necessarily have to link the two if you don't want to.
Upvotes: 4