This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Problem with tabbed panes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with tabbed panes" Watch "Problem with tabbed panes" New topic
Author

Problem with tabbed panes

pandu chinnu
Greenhorn

Joined: Nov 21, 2006
Posts: 16
Hi,

I was trying to create tabbed pane each pane name 'AuthorOne' , 'Authortwo' and 'Authorthree' ; however all having the same fuctionality. That is, on clicking any one of the three tabs, you get to see the same panel. The panel that I have added to all three tabs is Panel1, however on running the code I see only author 3 tab...what happened to authorone and author2 tab. Please note that panel1 contains another 2 panels with buttons and textarea.

Darrin Cartwright
Ranch Hand

Joined: Dec 27, 2002
Posts: 107
Hi Pandu,

You may want the same panel object on each of the tabs, but you will need a separate instance of the panel for each. You are basically adding the same component to the tabbed pane three times, and renaming it each time. Thus, the last name is the one displayed.
Create three of whatever panel1 is, and add those three objects to the tabbed pane.

Hope that helps,

Darrin


Life is good on the Ponderosa,<br />but mind where you step.
pandu chinnu
Greenhorn

Joined: Nov 21, 2006
Posts: 16
Hi,

I thought of that, however panel1 contains panel2 and panel3 which again contains a number of components. So do I again rewrite the entire code?

Even if I do some thing like:



it dosen't seem to work,,,only the Author Three tab displays.
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
If you don't want the tabs to actually control what appears underneath, you could try something like this:


bitguru blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with tabbed panes