This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes Unloading a frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Unloading a frame" Watch "Unloading a frame" New topic
Author

Unloading a frame

Richard Mendoza
Ranch Hand

Joined: Feb 26, 2003
Posts: 48
I have a frame and in it is a button named close. What I want I want is if I click on the button, it should unload the frame (not to terminate the whole program). What should I do? What command should I put on the actionPerformed method of the button?
Can anybody help me? Thanks!

Richard
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8915
    
    8

<frame object>.hide() or <frame object>.setVisible(false)


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

hide or setVisible(false) will not free the resources used by the frame; they're a good choice if you're going to later show the frame again. Otherwise, use frame.dispose() to get rid of the frame altogether.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unloading a frame