Search code examples
javaswingjtabbedpane

Java JTabbedPane, how can I select a tab from a button?


How can I select a tab as if it was clicked by clicking on a button? I have googled and looked at all the actions but there are just just so many... :(

Anyone know off hand?

Thanks in advance!


Solution

  • Add an action listener to the button that calls setSelectedComponent, or setSelectedIndex on the JTabbedPane.