Java swing "children" windows
desktop-application, java, swing
Solution
... But there's something wrong with this method: when I close child window via x in the upper right corner, whole program terminates as if I was closing the main window. ...
Well, I would say you are on the right path. Just make sure that you do the following for your child frames :
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Then closing the child windows won't shut down your entire application.
HTH ! ;-)
Problem
Sorry for really simple question, but I wasnt able to find anything in the net, probably because I dont know the right terms to look for. When you have a desktop application, there are many so called children windows: one for options, one for "about" and so on. How to make them in Java Swing (with NetBeans tools - optional)? So far I just created another JFrame and on relevant event opened it the same way Main function launches, well, main JFrame. But there's something wrong with this method: when I close child window via x in the upper right corner, whole program terminates as if I was closing the main window. This is probably because NetBeans auto generated code for x and I can find and change it somewhere... but still I have a feeling that there must be a simpler proper way to add children JFrames (or JPanels or whatever is it for children windows) ;)