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

Relequestual picture Relequestual · May 27, 2009 · Viewed 23.7k times · Source

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!

Answer

Yishai picture Yishai · May 27, 2009

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