wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Default tab setting in Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Default tab setting in Swing" Watch "Default tab setting in Swing" New topic
Author

Default tab setting in Swing

Sharad
Greenhorn

Joined: Aug 04, 2008
Posts: 10
I am working on swing application.

In a panel, there are three tabs and when i am opening a starting my application, by default the 1st tab is displaying...

My requirement is - I need to display 3rd tab as a default , with out changing the order of tab.

Code snippet :-

JTabbedPane tabbedPane = new JTabbedPane();
tabbedPane.addTab("1st", panel1);
tabbedPane.addTab("2nd", panel2);
tabbedPane.addTab("3rd", panel3);

please let me know how to achieve this.

Thanks in advance
Sharad
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10486
    
    9

Originally posted by Sharad Golu:

My requirement is - I need to display 3rd tab as a default , with out changing the order of tab.


Welcome to the ranch Sharad.
Check out JTabbedPane#setSelectedIndex(int index).
You might also want to take a look at this tutirial while you are at it.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Sharad
Greenhorn

Joined: Aug 04, 2008
Posts: 10
Thanks Maneesh.

It is working.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Default tab setting in Swing