aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "getting rid of ContentPane/frame" Watch "getting rid of ContentPane/frame" New topic
Author

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
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

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]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: getting rid of ContentPane/frame