JTabbedPane中如何获取当前标签名称用Swing表示

来源:百度知道 编辑:UC知道 时间:2024/06/02 01:44:46

String temp = jtabbedpane.getTitleAt(jtabbedpane.getSelectedIndex());

getSelectedIndex()方法表示获得当前选择的选项卡的索引值(int类型,从0开始,-1表示未选中任何选项卡)。

getTitleAt(index)方法表示获得索引值为index的选项卡的标题。