如何在 JTabbedPane 中检查选项卡是否处于活动状态? [英] How to check whether the tab is active or not in JTabbedPane?
问题描述
如何在选项卡(嵌套类)本身的类中而不是在封闭类中检查 JTabbedPane 实例中的选项卡是否处于活动状态?
How can I check whether a tab in a JTabbedPane instance is active or not, in the class of the tab (nested class) itself and not in the enclosing class?
我知道有一个方法 booloean isEnabledAt(int index);
但是这个方法只能在封闭类中调用.而我想检查当前是否在选项卡类本身(嵌套类)中选择了选项卡.
I know that there is a method booloean isEnabledAt(int index);
but this method can only be called in the enclosing class. Whereas I want to check whether the tab is currently selected within the tab class itself (nested class).
有人可以建议怎么做吗?
Can anybody please suggest how?
推荐答案
你的组件有一个 parent,最终是 JTabbedPane
.JTabbedPane
有类似 getSelectedIndex()
或 getSelectedComponent()
.
Your component has a parent, eventually the JTabbedPane
. JTabbedPane
has methods like getSelectedIndex()
or getSelectedComponent()
.
这篇关于如何在 JTabbedPane 中检查选项卡是否处于活动状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!