How to switch tabs in jTabbedPane by clicking a Button?

前端 未结 5 566
有刺的猬
有刺的猬 2021-02-05 05:46

I have two JTabbedPanes, JTabbedPane1 & 2 How can I press button in JTabbedPane2 to show JTabbedPane1 ?

Here is the code for JTabbedPane:

public cla         


        
5条回答
  •  深忆病人
    2021-02-05 06:47

    You should use the method JTabbedPane.setSelectedIndex(int index) with the index of the tab you want.

提交回复
热议问题