954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Same panels different TabbedPane's?HOW?

Hi, I'm trying to use tabbedpanes, my objective is to have a frame split in half( in height).
You have the upper tabbed pane, and the lower tabbed pane. Both of them have the same three panels, so the user can choose wether to see panel1 in up and pane2 in down, or panel3 up and panel 1 down,etc.
Basicly, I tried to this doing this:

JTabbedPane panelUp = new JTabbedPane();
	JTabbedPane panelDown = new JTabbedPane();

		panelUp .addTab("Mao", icon, panel1, "Does nothing");
		panelUp .addTab("Meu", icon, panel2, "Does nothing");
		panelUp .addTab("Teu", icon, panel3, "Does nothing");

		panelDown .addTab("Mao2", icon, panel1, "Does nothing");
		panelDown .addTab("Meu2", icon, panel2, "Does nothing");
		panelDown .addTab("Teu2", icon, panel3, "Does nothing");

But if I do that, only the lower tabbedpane appears, and the upper one doesn't.

Can anyone help me?Give me a explanation?
Thanks


PS: I'm using a gridlayout to split the frame

duuude
Newbie Poster
7 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

A component can only have one parent. It can't be in two containers at the same time.

NormR1
Posting Expert
Moderator
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
 

Is there any way to work arround it?

duuude
Newbie Poster
7 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

Why do you want to use the SAME panel? To display the same stuff or what?
Use unique components for each container and have the components share what they use.

NormR1
Posting Expert
Moderator
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
 

hm, ok. thanks

duuude
Newbie Poster
7 posts since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

that not possible, that reall Swing bug if two Tabs contains same JComponents schema

mKorbel
Veteran Poster
1,141 posts since Feb 2011
Reputation Points: 480
Solved Threads: 224
 

Are you using Netbean IDE?
If so. Then select a tabbed panel on the JFrame. Then select 2 ,3,...pannels.

Anuradha Mandal
Junior Poster
122 posts since Sep 2010
Reputation Points: 0
Solved Threads: 10
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: