This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Positioning JPanels in a 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 "Positioning JPanels in a JPanel" Watch "Positioning JPanels in a JPanel" New topic

Positioning JPanels in a JPanel

Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
Is there a way I can create 4 JPanels inside an outer JPanel, however
initially only the top JPanel is visible. Then when an event occurs the others appear 1 directly below the other with no gaps?

Daniel Mayer
Ranch Hand

Joined: Sep 09, 2004
Posts: 103
Just put the panels in the appropriate layout, for example a BoxLayout, and hide() the three lower panels initially. Call show() on them once you want them to be visible.
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
I agree. Here's the link:
subject: Positioning JPanels in a JPanel