Two Laptop Bag*
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Positioning JPanels in a JPanel
Similar Threads
Linking two JPanels with a JButton
How to display the borders in Panels
What's difference between JPanel and JComponent?
Urgent!!!Want to add different panels in different rows..