Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

set which tab opens when application is launched  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I have a JTabbedpane in my application and it has 3 tabs

I would like that when the application is launched the 2 tab is displayed.

Can someone provide me with an example of how it can be done.

Thanks
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
after you initialize your tabbed pane just add the following line

jtabbedPane.setSelectedComponent(someComponent);
 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi chris

I'm no expert, but usually the tab that your program starts on should always be the farthest left tab in your tabs.So maybe instead of trying to switch to another tab on startup, why dont you try just adding the tabs to the tabbed pane in the order that you want them to appear(oh yeah and the first one on the left is always opened first).

Just an idea.
 
BWA HA HA HA HA HA HA! Tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!