JTabbedPane 切换tab页

this.tabbedpane.setSelectedIndex(index);

 

------------------------------------

void javax.swing.JTabbedPane.setSelectedIndex(int index)

 

Sets the selected index for this tabbedpane. The index must be a valid tab index or -1, which indicates that no tab should be selected (can also be used when there are no tabs in the tabbedpane). If a -1 value is specified when the tabbedpane contains one or more tabs, then the results will be implementation defined.

Parameters:
index the index to be selected
Throws:
IndexOutOfBoundsException - if index is out of range (index < -1 || index >= tab count)
See Also:
getSelectedIndex
SingleSelectionModel.setSelectedIndex
@beaninfo
preferred: true description: The tabbedpane's selected tab index.
posted @ 2021-10-29 10:32  断舍离-重学JAVA之路  阅读(199)  评论(0编辑  收藏  举报