本文整理汇总了Java中javax.swing.JTabbedPane.getSelectedComponent方法的典型用法代码示例。如果您正苦于以下问题:Java JTabbedPane.getSelectedComponent方法的具体用法?Java JTabbedPane.getSelectedComponent怎么用?Java JTabbedPane.getSelectedComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTabbedPane
的用法示例。
在下文中一共展示了JTabbedPane.getSelectedComponent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeAllButCurrent
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
void closeAllButCurrent() {
Component comp = getComponent(0);
if (comp instanceof JTabbedPane) {
JTabbedPane tabs = (JTabbedPane) comp;
Component current = tabs.getSelectedComponent();
int tabCount = tabs.getTabCount();
// #172039: do not use tabs.getComponents()
Component[] c = new Component[tabCount - 1];
for (int i = 0, j = 0; i < tabCount; i++) {
Component tab = tabs.getComponentAt(i);
if (tab != current) {
c[j++] = tab;
}
}
for (int i = 0; i < c.length; i++) {
((RefactoringPanel) c[i]).close();
}
}
}
示例2: getRefactoringPanelComp
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private Component getRefactoringPanelComp() {
RefactoringPanel.checkEventThread();
Component comp = getComponentCount() > 0 ? getComponent(0) : null;
if (comp instanceof JTabbedPane) {
JTabbedPane tabs = (JTabbedPane) comp;
return tabs.getSelectedComponent();
} else {
return comp;
}
}
示例3: getCurrentPanel
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public RefactoringPanel getCurrentPanel() {
if (getComponentCount() > 0) {
Component comp = getComponent(0);
if (comp instanceof JTabbedPane) {
JTabbedPane tabs = (JTabbedPane) comp;
return (RefactoringPanel) tabs.getSelectedComponent();
} else {
if (comp instanceof RefactoringPanel)
return (RefactoringPanel) comp;
}
}
return null;
}
示例4: getSelectedData
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private TestDataTablePanel getSelectedData() {
if (envTab.getSelectedComponent() instanceof JTabbedPane) {
JTabbedPane tab = (JTabbedPane) envTab.getSelectedComponent();
if (tab.getTabCount() > 0 && tab.getSelectedComponent() != null
&& tab.getSelectedComponent() instanceof TestDataTablePanel) {
return (TestDataTablePanel) tab.getSelectedComponent();
}
}
return null;
}