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