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

Recommended Answers

All 6 Replies

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

Is there any way to work arround it?

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.

hm, ok. thanks

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.