permaculture playing cards
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

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!

Joe Ess

Joined: Oct 29, 2001
Posts: 9189

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

[How To Ask Questions On JavaRanch]
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

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:
subject: Unloading a frame
It's not a secret anymore!