File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 24166
    
  30

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: http://aspose.com/file-tools
 
subject: getting rid of ContentPane/frame
 
Similar Threads
JFrame re-sizing, what methods are called?
Doubt in this Swing program. can anyone clear my doubt?
retrieving values from JTabbedPane
JLabel and JTextArea do not show properly in ubuntu
getContentPane()?