当前位置: 首页>>代码示例>>Java>>正文


Java JTabbedPane.getSelectedIndex方法代码示例

本文整理汇总了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;

}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:28,代码来源:ProjectWindow.java

示例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);
                }
            }
        }
    };
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:17,代码来源:TestDataComponent.java

示例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 + "'");
            }
        }
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:21,代码来源:TestDataComponent.java

示例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();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:DiffViewModeSwitcher.java

示例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 "";
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:JTabbedPaneJavaElement.java

示例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));
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:RTabbedPane.java

示例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();
}
 
开发者ID:tslaats,项目名称:SE2017-Team2,代码行数:33,代码来源:GUIPane.java

示例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);
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:10,代码来源:TestDataComponent.java

示例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);
    }
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:8,代码来源:FramePrincipal.java


注:本文中的javax.swing.JTabbedPane.getSelectedIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。