本文整理匯總了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;
}
}
}
}
示例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!");
}
}
}
示例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();
}
}
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
}
}