• Post Reply Bookmark Topic Watch Topic
  • New Topic

set which tab opens when application is launched

 
Chris Song
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
 
Mart Laf
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);
 
luc comeau
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!