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 Closing a panel Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Closing a panel" Watch "Closing a panel" New topic
Author

Closing a panel

Mythily Jaganathan
Greenhorn

Joined: Aug 22, 2006
Posts: 19
Hi all,

I have to close(exit) a JPanel without using System.exit() method.
Please help me to solve this problem.

Thanks in advance,
Mythily
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
is it the contentPane for a dialog/frame?
if so, use the dialog/frame's dispose()
Mythily Jaganathan
Greenhorn

Joined: Aug 22, 2006
Posts: 19
Hi,

It is not a contentpane. It is a panel with griddedbag layout.

Thanks
Mythily
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
all you can do is remove it from its container.

then, depending on container type, you call
validate();
or
revalidate();

and, sometimes a call to repaint() is also required
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Closing a panel