This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread 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

Win a copy of Building Microservices this week in the Design 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
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Positioning JPanels in a JPanel
It's not a secret anymore!