tags:

views:

231

answers:

1

I'm try to implement my program by using JFrame Form on Netbean. Then when i use my main frame to popup other frame and i close that frame, my main frame will close too. How can i avoid this case.

Thank you in advance.

+1  A: 

Your second popup frame has the default close operation "EXIT_ON_CLOSE". This exits the whole program. So, you have to set this to DISPOSE_ON_CLOSE. That will close only the frame you clicked the close button.

In code this will be:

your_frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

In Netbeans, you have to go to the frame editor modus. Select your frame, and change that property in in the propery-window. You can access it by a right-click on the frame and than "Properties".

Hope this helps.

Martijn Courteaux