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 / March 2005

Tip: Looking for answers? Try searching our database.

JFrame - how to properly and cleanly close?

Thread view: 
farseer - 26 Mar 2005 08:03 GMT
Hi,
i have a class that extends a JFrame.
>From a main function i create an instance of that class.
Now for the problem..

With Task manager up and watching this java process:
-i click the "X" close icon on the top right of the window.  the window
closes, but the javaw.exe process is still showing in task manager.

-now, from a JButton on the form, i simply add the code "System.exit( 0
);".  When that button is clicked, the javaw.exe process no longer
shows in task manager.

why is this and how can make sure that this app is cleanly closed when
a user clicks on the "X" window icon?
Sameer Shinde - 26 Mar 2005 09:07 GMT
The default close operation for JFrame is presently JFrame.HIDE_ON_CLOSE.

Change it to EXIT_ON_CLOSE.

see documentation related to setDefaultCloseOperation......

-Sameer
farseer - 27 Mar 2005 08:58 GMT
thanks much. that did it


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.