This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 9990
    
    7

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Default tab setting in Swing
 
Similar Threads
Problems using JTabbedPane In a GUI application
JtabbedPane Question
Design question regarding JTabbedPane
2 dimensional JTabbedPane
JTabbedPane Problem