當前位置: 首頁>>代碼示例>>Java>>正文


Java JTabbedPane.getTabCount方法代碼示例

本文整理匯總了Java中javax.swing.JTabbedPane.getTabCount方法的典型用法代碼示例。如果您正苦於以下問題:Java JTabbedPane.getTabCount方法的具體用法?Java JTabbedPane.getTabCount怎麽用?Java JTabbedPane.getTabCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JTabbedPane的用法示例。


在下文中一共展示了JTabbedPane.getTabCount方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleNotFound

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private void handleNotFound(String id, String exactCategory, String exactTabTitle) {
    if (!disabledCategories.contains(id)) {
        disabledCategories.add(id);
    }
    JTabbedPane pane = categoryid2tabbedpane.get(id);
    if (categoryid2tabs.get(id) != null && pane != null) {
        for (int i = 0; i < pane.getTabCount(); i++) {
            pane.setEnabledAt(i, false);
        }
    }
    buttons.get(id).setEnabled(false);
    if (disabledCategories.size() == buttons.size()) {
        setCurrentCategory(null, null);
    } else {
        for (String id3 : categoryModel.getCategoryIDs()) {
            if (buttons.get(id3).isEnabled() && ((exactCategory != null && exactCategory.equals(id3)) || (exactCategory == null && exactTabTitle == null))) {
                setCurrentCategory(categoryModel.getCategory(id3), null);
                break;
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:OptionsPanel.java

示例2: test

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private static void test() {

        int N = 5;
        JTabbedPane tabbedPane = new JTabbedPane();

        for (int i = 0; i < N; i++) {
            tabbedPane.addTab("Title: " + i, new JLabel("Component: " + i));
        }

        for (int i = 0; i < tabbedPane.getTabCount(); i++) {
            Component child = tabbedPane.getComponentAt(i);

            AccessibleContext ac = child.getAccessibleContext();
            if (ac == null) {
                throw new RuntimeException("Accessible Context is null!");
            }

            int index = ac.getAccessibleIndexInParent();
            Accessible parent = ac.getAccessibleParent();

            if (parent.getAccessibleContext().getAccessibleChild(index) != child) {
                throw new RuntimeException("Wrong getAccessibleIndexInParent!");
            }
        }
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:AccessibleIndexInParentTest.java

示例3: 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();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:RefactoringPanelContainer.java

示例4: componentClosed

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
@Override
protected void componentClosed() {
    isVisible = false;
    if (getComponentCount() == 0) {
        return ;
    }
    Component comp = getComponent(0);
    if (comp instanceof JTabbedPane) {
        JTabbedPane pane = (JTabbedPane) comp;
        // #172039: do not use tabs.getComponents()
        Component[] c = new Component[pane.getTabCount()];
        for (int i = 0; i < c.length; i++) {
            c[i] = pane.getComponentAt(i);
        }
        for (int i = 0; i < c.length; i++) {
            ((RefactoringPanel) c[i]).close();
        }
    } else if (comp instanceof RefactoringPanel) {
        ((RefactoringPanel) comp).close();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:RefactoringPanelContainer.java

示例5: setTabTitle

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
/**
 * Sets the tab title.
 */
private void setTabTitle() {
	
	String tabTitle = "";
	if (this.getSeriesTableModels().size()==0) {
		tabTitle = "Table (0)";
	} else {
		tabTitle = "Table (" + (currSeriesSelection+1) + "/" +  this.getSeriesTableModels().size() + ")";
	}
	Container tableTab = this.myJTable.getParent().getParent().getParent();
	JTabbedPane editorTabbedPane =(JTabbedPane) tableTab.getParent();
	if (editorTabbedPane!=null) {
		int tabPosIndex = 0;
		for (tabPosIndex=0; tabPosIndex<editorTabbedPane.getTabCount(); tabPosIndex++) {
			if (editorTabbedPane.getComponentAt(tabPosIndex)==tableTab) {
				break;
			}
		}
		editorTabbedPane.setTitleAt(tabPosIndex, tabTitle);
	}
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:24,代碼來源:XyTableModel.java

示例6: navigateToTestData

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
public Boolean navigateToTestData(String sheetName, String columnName) {
    if (envTab.getSelectedComponent() instanceof JTabbedPane) {
        JTabbedPane tab = (JTabbedPane) envTab.getSelectedComponent();
        for (int i = 0; i < tab.getTabCount(); i++) {
            if (tab.getComponentAt(i) instanceof TestDataTablePanel) {
                TestDataTablePanel tdPanel = (TestDataTablePanel) tab.getComponentAt(i);
                if (tdPanel.std.getName().equals(sheetName)) {
                    int colIndex = tdPanel.std.getColumnIndex(columnName);
                    if (colIndex != -1) {
                        tab.setSelectedIndex(i);
                        tdPanel.table.selectColumn(colIndex);
                        return true;
                    }
                    break;
                }
            }
        }
    }
    return false;
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:21,代碼來源:TestDataComponent.java

示例7: showedTabAt

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private int showedTabAt(JTabbedPane tabbedPane, String title) {
	// TODO Auto-generated method stub
	int exist = -1;
	int i=0;
	while ((i<tabbedPane.getTabCount()) && (!title.equals(tabbedPane.getTitleAt(i))))
		i++;
	
	if(i == tabbedPane.getTabCount())
		return -1;
	
	else
		return i;
}
 
開發者ID:BlidiWajdi,項目名稱:Mujeed-Arabic-Prolog,代碼行數:14,代碼來源:OpenFileListener.java

示例8: getNextEnabledTabIndex

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private int getNextEnabledTabIndex(JTabbedPane pane, int currentIndex) {
    for (int i = currentIndex + 1; i < pane.getTabCount(); i++) {
        if(pane.isEnabledAt(i)) {
            return i;
        }
    }
    for (int i = 0; i < currentIndex; i++) {
        if(pane.isEnabledAt(i)) {
            return i;
        }
    }
    return -1;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:OptionsPanel.java

示例9: clearAllinQS

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private void clearAllinQS() {
clearSearch = true;
for (String id : categoryModel.getCategoryIDs()) {
    JTabbedPane pane = categoryid2tabbedpane.get(id);
    if (categoryid2tabs.get(id) != null && pane != null) {
	for (int i = 0; i < pane.getTabCount(); i++) {
	    pane.setEnabledAt(i, true);
	}
    }
    buttons.get(id).setEnabled(true);
}
setCurrentCategory(categoryModel.getCurrent(), null);
disabledCategories.clear();
categoryModel.getCurrent().handleSuccessfulSearchInController(null, null);
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:OptionsPanel.java

示例10: selectJWTSuiteTab

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
public void selectJWTSuiteTab() {
	Component current = this.getUiComponent();
	do {
		current = current.getParent();
	} while (!(current instanceof JTabbedPane));

	JTabbedPane tabPane = (JTabbedPane) current;
	for (int i = 0; i < tabPane.getTabCount(); i++) {
		if (tabPane.getTitleAt(i).equals(this.getTabCaption()))
			tabPane.setSelectedIndex(i);
	}
}
 
開發者ID:mvetsch,項目名稱:JWT4B,代碼行數:13,代碼來源:JWTSuiteTabController.java

示例11: findTabIndex

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private int findTabIndex(JTabbedPane tp, String tab) {
    int tabCount = tp.getTabCount();
    int tabIndex = -1;
    for (int index = 0; index < tabCount; index++) {
        String current = JTabbedPaneTabJavaElement.getText(tp, index);
        if (tab.equals(current)) {
            tabIndex = index;
            break;
        }
    }
    return tabIndex;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:13,代碼來源:JTabbedPaneJavaElement.java

示例12: getContent

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
public static String[][] getContent(JTabbedPane component) {
    int nItems = component.getTabCount();
    String[][] content = new String[1][nItems];
    for (int i = 0; i < nItems; i++) {
        content[0][i] = JTabbedPaneTabJavaElement.getText(component, i);
    }
    return content;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:9,代碼來源:JTabbedPaneJavaElement.java

示例13: addTab

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
public void addTab(JTabbedPane workspace, JTabContent tab, boolean autoSwitch) {
	workspace.addTab(tab.getName(), tab);
	final int index = workspace.getTabCount() - 1;
	workspace.setTabComponentAt(index, new JTabPanel(tab));
	if (autoSwitch) {
		workspace.getModel().setSelectedIndex(index);
	}
}
 
開發者ID:roscisz,項目名稱:KernelHive,代碼行數:9,代碼來源:WorkspaceHelper.java

示例14: createSyntaxHelp

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
/** Creates and returns a panel for the syntax descriptions. */
private JComponent createSyntaxHelp() {
    initSyntax();
    final JTabbedPane tabbedPane = new JTabbedPane();
    final int nodeTabIndex = tabbedPane.getTabCount();
    tabbedPane.addTab("Nodes",
        null,
        createSyntaxList(this.nodeKeys),
        "Label prefixes that are allowed on nodes");
    final int edgeTabIndex = tabbedPane.getTabCount();
    tabbedPane.addTab("Edges",
        null,
        createSyntaxList(this.edgeKeys),
        "Label prefixes that are allowed on edges");
    if (this.role == GraphRole.RULE) {
        tabbedPane.addTab("RegExpr", null, createSyntaxList(RegExpr.getDocMap()
            .keySet()), "Syntax for regular expressions over labels");
        tabbedPane.addTab("Expr", null, createSyntaxList(Algebras.getDocMap()
            .keySet()), "Available attribute operators");
    }
    JPanel result = new TitledPanel("Label syntax help", tabbedPane, null, false);
    // add a listener that switches the syntax help between nodes and edges
    // when a cell edit is started in the JGraph
    getJGraph().addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName() == JGraph.CELL_EDIT_PROPERTY) {
                int index =
                    evt.getNewValue() instanceof AspectJEdge ? edgeTabIndex : nodeTabIndex;
                tabbedPane.setSelectedIndex(index);
            }
        }
    });
    return result;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:36,代碼來源:GraphEditorTab.java

示例15: openTab

import javax.swing.JTabbedPane; //導入方法依賴的package包/類
private void openTab(Component component, JTabbedPane pane) {
    for (int i = 0; i < pane.getTabCount(); i++) {
        if (component == pane.getComponentAt(i)) {
            pane.setSelectedIndex(i);
            break;
        }
    }
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:9,代碼來源:Control.java


注:本文中的javax.swing.JTabbedPane.getTabCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。