| Author |
JTabbedPane Problem
|
smitha verghese
Ranch Hand
Joined: Jun 21, 2003
Posts: 42
|
|
Hi, I have a main TabbedPane where i added 3 tabs A,B,C Now i need to add a TabbedPane into A?? how do i do it? Please let me know as soon as possible Thanks regards Smitha
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
|
When you add a tab ( tabbedPane.addTab(..) ) you have to specify a Component. Just pass that method another JTabbedPane object.
|
 |
smitha verghese
Ranch Hand
Joined: Jun 21, 2003
Posts: 42
|
|
JTabbedPane tabbedPane1 = new JTabbedPane(); JTabbedPane motorTab= new JTabbedPane(); MainTab() { setLayout(new BorderLayout()); motorTab.addTab("Ascans",new Ascans()); ---------------------------------------- ---------------------------------------- } Ascans is a panel class Ascans extends JPanel{ Ascans() { setLayout(new BorderLayout()); setBounds(30, 40,300, 200); setBackground(Color.blue); setVisible(true); } } But it doesnt add tabs one after another rather adds one on top of another how come?
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
You aren't even doing what I said to do. You asked how to add a JTabbedPane to a Tab on a JTabbedPane. All your code does is instantiate 2 JTabbedPanes(), one of which is never used, and then you put a panel on one of the Tabs. This is the solution to your original question. Is this not what you want?
|
 |
 |
|
|
subject: JTabbedPane Problem
|
|
|