File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes about JTabbed Pane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "about JTabbed Pane" Watch "about JTabbed Pane" New topic

about JTabbed Pane

sachin dabhade
Ranch Hand

Joined: Mar 10, 2001
Posts: 73
I have an applicatin where i have used JTabbedPane.
It contains a tab called " Inventory" and "Others"
on clicking,inventory i want to open another TabbedPane on the same contentpane with following tabs.
1.Add Item
2.Remove Item
3.Check inventory.
i tried adding another tabbedpane to the same contentpane but only the first tabbedpane is displayed.
the sub tabbed pane is not displayed.
can anybody help me to get a path out of it?
thanks in advance.

keerthi matta

Joined: May 31, 2002
Posts: 27
According to ur requirement when u click on the Inventory tab , the another TabbedPane is being added to the Container , but this Tabbed Pane is at the back of the first TabbedPane , so it is not being displayed , and i dont think u need one more TabbedPane to add , becoz when u can add these new Tabs to the previous Tabbed Pane itself , they will displayed after the "Others" Tab . Hope this will solve ur problem .
Chris Shepherd
Ranch Hand

Joined: Jun 27, 2000
Posts: 286
Hmm are you actually trying to replace the "inventory/other" tabbedPane with the other one or are you just trying to show the new one inside the inventorypane?
Adding it inside the inventory pane should be fairly easy. You just have to put the tabbedPane with all the inventory options inside a JPanel and then include that when you make your call to add the Inventory pane.

If you are trying to replace the main tabbedPane when you select the "inventory" tab, you should consider using something besides a tabbedPane for this selection. TabbedPane is made to switch between displayed panels/viewable objects easily, not to be used like buttons.
I agree. Here's the link:
subject: about JTabbed Pane
It's not a secret anymore!