aspose file tools
The moose likes Swing / AWT / SWT and the fly likes one component .. multiple panels Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "one component .. multiple panels" Watch "one component .. multiple panels" New topic

one component .. multiple panels

Joined: Dec 09, 2004
Posts: 1

How to add a single component (say a Button) to multiple panels? The requirement is to show only one panel at a given instance but at the time of initialising the class I am adding all the components to the panels. (same components are added to 2 panels). But while showing the First panel the components added to the First panel are not shown and are only displayed if the shown panel is Second One.

Pls. clarify or help me out with this ...

Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
You can only add a component to one container. If you add it to another it is removed from the first and added to the second. You must make a new component for each use. You can however use the same reference...
Consider Paul's rocket mass heater.
subject: one component .. multiple panels