aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes resizing JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "resizing JPanel" Watch "resizing JPanel" New topic
Author

resizing JPanel

Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255
Often when I add a widget to a JPanel that is on a JFrame, it doesn't show up. I had the same problem with JFrame. Stuff that I added to a JFrame didn't show up. I figured out that if you resize the JFrame, or use pack(), or setVisible(true), the changes made to JFrame would become visible. Is there some kind of command that you should use for a JPanel that would make it reflect changes in its content (specifically, showing the added widget)?
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Try revalidate().


bitguru blog
Kevin Tysen
Ranch Hand

Joined: Oct 12, 2005
Posts: 255
Thank you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: resizing JPanel
 
Similar Threads
Layout Problems
JFileChooser showing twice
What's difference between JPanel and JComponent?
Java plotting application
Detect when a JPanel dies