• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Default tab setting in Swing

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Sharad
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Maneesh.

It is working.
 
Curse your sudden but inevitable betrayal! And this tiny ad too!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic