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 commonPanel appear only in the last card with the CardLayout manager 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 "commonPanel appear only in the last card with the CardLayout manager" Watch "commonPanel appear only in the last card with the CardLayout manager" New topic
Author

commonPanel appear only in the last card with the CardLayout manager

albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 252
Why the commonPanel appear only in the last card with the CardLayout manager?
How to make the commonPanel appear in all the cards with the CardLayout manager?

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
it can only have one parent, so each time it is added to a new 'card', it is removed from the older card.

some options:
1) you can make commonPanel a class, then add a new instance of it to each card.
2) create a holding panel, cardlayout panel on top (or bottom), commonPanel in other area,
so only the 'cards' change
albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 252
Michael Dunn wrote:it can only have one parent, so each time it is added to a new 'card', it is removed from the older card.

some options:
1) you can make commonPanel a class, then add a new instance of it to each card.
2) create a holding panel, cardlayout panel on top (or bottom), commonPanel in other area,
so only the 'cards' change


Option 2:
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: commonPanel appear only in the last card with the CardLayout manager
 
It's not a secret anymore!