Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / April 2008

Tip: Looking for answers? Try searching our database.

Close a frame, not the application?

Thread view: 
WJ - 11 Apr 2008 14:00 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.