Hi all,
In an application I open a new frame by clicking a button in the main
frame. When I close the new frame, the application terminates. How can I
close the frame, without closing the application?
Thanx,
WJ
Steve W. Jackson - 11 Apr 2008 14:28 GMT
> Hi all,
>
[quoted text clipped - 4 lines]
> Thanx,
> WJ
Sounds like a matter for JFrame's setDefaultCloseOperation method. If
you tell it to exit on close, it exits the application. Instead, you
can have it dispose on close, which merely disposes the JFrame, or you
can do something else at your discretion in a window listener and set
this to do nothing on close. See the API Javadocs for details.

Signature
Steve W. Jackson
Montgomery, Alabama
Roedy Green - 11 Apr 2008 22:27 GMT
>In an application I open a new frame by clicking a button in the main
>frame. When I close the new frame, the application terminates. How can I
>close the frame, without closing the application?
see http://mindprod.com/jgloss/jframe.html
It explains the various ways you can control what happens on close.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Chase Preuninger - 13 Apr 2008 16:03 GMT
You should first of all use JDialog, that would fix the problem. But
however if you are hell bent on using JFrame just use the
f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE) method.