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 / General / October 2007

Tip: Looking for answers? Try searching our database.

How to destroy a window

Thread view: 
Click - 03 Oct 2007 16:17 GMT
Hello all.

I have a question that might seem stupid to most of you, but I cannot find
how to do it.

How can I destroy a window (JFrame)? I mean not by exiting the application.
But just destroying the window so that my app can go on. I know that just
setting the pointer to my window to null will not destroy it.
I just cant find it in the docs! The docs say that "dispose" releases the
resources used by the window, but not the window itself.

Thanks for helping me!

Francois
Jason Cavett - 03 Oct 2007 16:40 GMT
> Hello all.
>
[quoted text clipped - 10 lines]
>
> Francois

As far as I know, destroy() does what you're looking to do (assuming
you don't have the problems below).  destroy() does not necessarily
exit the JVM - it only *can* do that if the window you destroyed was
the last one.

As far as "destroying the window so my app can go on" - that sounds
more like a problem with the window itself.  Is the window expecting
some input before the app can continue?  Are you doing "work" in the
EventQueue thread?
Daniel Pitts - 03 Oct 2007 16:31 GMT
>> Hello all.
>>
[quoted text clipped - 20 lines]
> some input before the app can continue?  Are you doing "work" in the
> EventQueue thread?

dispose() will close the window.

Signature

Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

Matt Humphrey - 03 Oct 2007 16:43 GMT
| Hello all.
|
[quoted text clipped - 6 lines]
| I just cant find it in the docs! The docs say that "dispose" releases the
| resources used by the window, but not the window itself.

dispose() is what you want. If it makes you feel better you can
setVisible(false) first to make the visual aspects of the window disappear
first, but really the visual appearance of the window (vs. its internal data
structure) is part of the resources that are being disposed of. It will
vanish on its own when you call dispose(). After that you can set your
window refs to null and the GC will do the rest.

Matt Humphrey http://www.iviz.com/


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.