本文整理汇总了Java中javax.swing.JTabbedPane.getSelectedIndex方法的典型用法代码示例。如果您正苦于以下问题:Java JTabbedPane.getSelectedIndex方法的具体用法?Java JTabbedPane.getSelectedIndex怎么用?Java JTabbedPane.getSelectedIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTabbedPane
的用法示例。
在下文中一共展示了JTabbedPane.getSelectedIndex方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProjectWindowTabSelected
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
/**
* Gets the currently selected tab as instance of ProjectWindowTab.
*
* @return the tab selected
*/
private ProjectWindowTab getProjectWindowTabSelected() {
ProjectWindowTab tabSelected = null;
int selIndex = this.projectViewRightTabs.getSelectedIndex();
if (selIndex > -1) {
String tabTitle = this.projectViewRightTabs.getTitleAt(selIndex);
tabSelected = getProjectWindowTab(tabTitle);
if (tabSelected != null) {
JTabbedPane subPane = tabSelected.getCompForChildComp();
if (subPane != null) {
int selSubIndex = subPane.getSelectedIndex();
if (selSubIndex != -1) {
tabTitle = subPane.getTitleAt(selSubIndex);
tabSelected = getProjectWindowTab(tabTitle);
}
}
}
}
return tabSelected;
}
示例2: onAddNewTDTab
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private MouseAdapter onAddNewTDTab() {
return new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
JTabbedPane tabbedPane = (JTabbedPane) me.getSource();
if (tabbedPane.getSelectedIndex() != -1 && getSelectedData() == null) {
Rectangle rect = tabbedPane.getUI().
getTabBounds(tabbedPane, tabbedPane.getSelectedIndex());
if (rect.contains(me.getPoint())) {
tabbedPane.setSelectedIndex(tabbedPane.getSelectedIndex() - 1);
addNewTestData(tabbedPane);
}
}
}
};
}
示例3: deleteTestData
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void deleteTestData(Object source) {
JTabbedPane tab = (JTabbedPane) source;
TestDataTablePanel panel = getSelectedData();
if (!panel.isGlobalData) {
int index = tab.getSelectedIndex();
String name = tab.getTitleAt(index);
int option = JOptionPane.showConfirmDialog(null, "Are you sure want to delete the TestData [" + name + "]", "Delete TestData", JOptionPane.YES_NO_OPTION);
if (option == JOptionPane.YES_OPTION) {
Boolean flag = testDesign.getProject().getTestData()
.getTestDataFor(envTab.getTitleAt(envTab.getSelectedIndex()))
.deleteTestData(name);
if (flag) {
tab.setSelectedIndex(index - 1);
tab.removeTabAt(index);
} else {
Notification.show("Couldn't Delete Testdata - '" + name + "'");
}
}
}
}
示例4: stateChanged
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
@Override
public void stateChanged (ChangeEvent e) {
Object source = e.getSource();
if (source instanceof JTabbedPane) {
JTabbedPane tabPane = (JTabbedPane) source;
if (handledViews.containsKey(tabPane)) {
diffViewMode = tabPane.getSelectedIndex();
}
}
}
示例5: getSelectedItemText
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
public static String getSelectedItemText(JTabbedPane component) {
int selectedIndex = component.getSelectedIndex();
if (selectedIndex != -1) {
return JTabbedPaneTabJavaElement.getText(component, selectedIndex);
}
return "";
}
示例6: stateChanged
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
@Override public void stateChanged(ChangeEvent e) {
JTabbedPane tp = (JTabbedPane) component;
int selectedIndex = tp.getSelectedIndex();
if (selectedIndex != -1) {
recorder.recordSelect(this, JTabbedPaneTabJavaElement.getText(tp, selectedIndex));
}
}
示例7: stateChanged
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
JTabbedPane sourceTabbedPane = (JTabbedPane) e.getSource();
int index = sourceTabbedPane.getSelectedIndex();
Main.updateUserMsg("Tab changed to: " + sourceTabbedPane.getTitleAt(index));
GraphTab graphTab = graphTabs.get(index);
try {
GuiController.ActiveGraphID = graphTab.getId();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
graphTab.updateImage();
if (simulation) {
updateActions();
} else {
// toggle menus for the correct graph type
if (graphTab.getCrGraph()) {
Menu.enableCRMenu();
Menu.disablePetriMenu();
} else {
Menu.enablePetriMenu();
Menu.disableCRMenu();
}
Menu.enableNewMenubar();
}
sourceTabbedPane.setComponentAt(index, graphTab.getpanel());
sourceTabbedPane.repaint();
}
示例8: closeTestData
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void closeTestData(Object source) {
JTabbedPane tab = (JTabbedPane) source;
TestDataTablePanel panel = getSelectedData();
if (!panel.isGlobalData) {
int index = tab.getSelectedIndex();
tab.setSelectedIndex(index - 1);
tab.removeTabAt(index);
}
}
示例9: TabInspectorStateChanged
import javax.swing.JTabbedPane; //导入方法依赖的package包/类
private void TabInspectorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_TabInspectorStateChanged
JTabbedPane sourceTabbedPane = (JTabbedPane) evt.getSource();
int index = sourceTabbedPane.getSelectedIndex();
if (index == 1) {
DoComandoExterno(Controler.menuComandos.cmdTreeNavegador);
}
}