File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes getting rid of ContentPane/frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "getting rid of ContentPane/frame" Watch "getting rid of ContentPane/frame" New topic

getting rid of ContentPane/frame

Naf Rash
Ranch Hand

Joined: Feb 19, 2004
Posts: 85
I wanted to ask - how do you get rid of a frame/contentPane completely without causing a program to terminate? I have used setVisible(false) but just empties the content pane- i just want to discard it.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Calling setVisible(false) on a JFrame completely removes it from the screen; calling dispose() on it ensures it could never be reused.
Your message suggests you've tried calling aFrame.getContentPane().setVisible(false). I'm impressed by your creativity, but don't do that.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: getting rid of ContentPane/frame
It's not a secret anymore!