wood burning stoves*
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
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: 8935
    
    9

<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]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Unloading a frame