aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes clear JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "clear JPanel" Watch "clear JPanel" New topic
Author

clear JPanel

Marc Beck
Ranch Hand

Joined: Sep 09, 2006
Posts: 36
How do I clear a JPanel?
I mean, I want to remove all its components without calling each of them individually.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39834
    
  28
Have you looked through the API specifications for JPanel to see whether there are any methods which remove all components?
Qunfeng Wang
Ranch Hand

Joined: Jan 28, 2005
Posts: 433
Just my two cents: Don't forget to invoke validate() on the JPanel to reflect changes when you remove all its components.


To be or not to be. It's a question.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

Better make it revalidate() instead of validate() since its a JPanel


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: clear JPanel