• Post Reply Bookmark Topic Watch Topic
  • New Topic

How set focus to a new Tabbed Pane.

 
Dave Trower
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a java program that adds a new Tabbed Pane. I would like to set
the focus to the new pane. How can I do this?
 
Constanze Michaelis
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what about

regards
Constanze
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tabbedPane.requestFocusInWindow()

but it must be called after the tabbedPane is visible.

something like this order in the constructor(or buidGUI method)

public [className]()
{
...
panel.add(tabbedPane);
frame.add(panel);
frame.setVisible(true);
tabbedPane.requestFocusInWindow()
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!