javax.swing.JTabbedPane.getTabCount()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(176)

本文整理了Java中javax.swing.JTabbedPane.getTabCount()方法的一些代码示例,展示了JTabbedPane.getTabCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTabbedPane.getTabCount()方法的具体详情如下:
包路径:javax.swing.JTabbedPane
类名称:JTabbedPane
方法名:getTabCount

JTabbedPane.getTabCount介绍

暂无

代码示例

代码示例来源:origin: groovy/groovy-core

/**
 * Provide the standard Groovy <code>size()</code> method for <code>JTabbedPane</code>.
 *
 * @param self a JTabbedPane
 * @return the tab count of the tabbedPane
 * @since 1.6.4
 */
public static int size(JTabbedPane self) {
  return self.getTabCount();
}

代码示例来源:origin: groovy/groovy-core

public boolean hasNext() {
  return index > -1 && index < self.getTabCount();
}

代码示例来源:origin: chewiebug/GCViewer

private void updateTabDisplay(GCResource gcResource) {
  // enable only "parser" panel, as long as model contains no data
  boolean modelHasData = gcResource.getModel() != null && gcResource.getModel().size() > 0;
  for (int i = 0; i < modelChartAndDetailsPanel.getTabCount(); ++i) {
    modelChartAndDetailsPanel.setEnabledAt(i, 
        modelHasData
        || modelChartAndDetailsPanel.getTitleAt(i).equals(
            LocalisationHelper.getString("data_panel_tab_parser")));
  }
  
  if (!gcResource.isReload()) {
    if (modelHasData) {
      modelChartAndDetailsPanel.setSelectedIndex(0);
    }
    else {
      modelChartAndDetailsPanel.setSelectedIndex(modelChartAndDetailsPanel.getTabCount()-1);
    }
  }
}

代码示例来源:origin: deathmarine/Luyten

@Override
  public void actionPerformed(ActionEvent e) {
    JTabbedPane house = mainWindow.getModel().house;
    
    if (e.getModifiers() != 2 || house.getTabCount() == 0)
      mainWindow.onCloseFileMenu();
    else {
      mainWindow.getModel().closeOpenTab(house.getSelectedIndex());
    }
  }
});

代码示例来源:origin: stackoverflow.com

g2D.setColor(hazAlfa(getRunForTab(tabPane.getTabCount(), tabIndex) - 1));
g2D.fill(shape);

代码示例来源:origin: ron190/jsql-injection

@Override
  public void actionPerformed(ActionEvent e) {
    if (valuesTabbedPane.getTabCount() > 0) {
      int selectedIndex = valuesTabbedPane.getSelectedIndex();
      if (selectedIndex + 1 < valuesTabbedPane.getTabCount()) {
        valuesTabbedPane.setSelectedIndex(selectedIndex + 1);
      } else {
        valuesTabbedPane.setSelectedIndex(0);
      }
    }
  }
};

代码示例来源:origin: ron190/jsql-injection

@Override
  public void actionPerformed(ActionEvent e) {
    if (valuesTabbedPane.getTabCount() > 0) {
      int selectedIndex = valuesTabbedPane.getSelectedIndex();
      if (selectedIndex - 1 > -1) {
        valuesTabbedPane.setSelectedIndex(selectedIndex - 1);
      } else {
        valuesTabbedPane.setSelectedIndex(valuesTabbedPane.getTabCount() - 1);
      }
    }
  }
};

代码示例来源:origin: stackoverflow.com

private void addTab(JTabbedPane tabbedPane, Component tab, String title, Icon icon) {
 tabbedPane.add(tab);

 JLabel lbl = ... // Create bespoke label for rendering tab title.

 tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1, lbl);
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void mouseWheelMoved(MouseWheelEvent e) {
  JTabbedPane tabPane = (JTabbedPane) e.getSource();
  int dir = -e.getWheelRotation();
  int selIndex = tabPane.getSelectedIndex();
  int maxIndex = tabPane.getTabCount() - 1;
  if ((selIndex == 0 && dir < 0) || (selIndex == maxIndex && dir > 0)) {
    selIndex = maxIndex - selIndex;
  } else {
    selIndex += dir;
  }
  if (0 <= selIndex && selIndex < tabPane.getTabCount()) {
    // Fix #54575: NullPointerException on setSelectedIndex()
    try {
      tabPane.setSelectedIndex(selIndex);
    } catch (NullPointerException err) {
      LOGGER.error(err, err);
    }
  }
}

代码示例来源:origin: ron190/jsql-injection

SqlEngine.TAB_ERROR.setTitleAt(SqlEngine.TAB_ERROR.getTabCount() - 1, "<html><div style=\"text-align:left;width:150px;\">"+ methodError.getName() +"</div></html>");

代码示例来源:origin: knowm/XChart

int tabCount = tabbedPane.getTabCount();
for (int i = tabCount - 1; i >= 0; i--) {
 tabbedPane.remove(i);

代码示例来源:origin: ron190/jsql-injection

protected DnDTabbedPane() {
  super();
  Handler h = new Handler();
  this.addMouseListener(h);
  this.addMouseMotionListener(h);
  this.addPropertyChangeListener(h);
  
  this.addMouseWheelListener(mouseWheelEvent -> {
    JTabbedPane tabPane = (JTabbedPane) mouseWheelEvent.getSource();
    
    int dir = -mouseWheelEvent.getWheelRotation();
    int selIndex = tabPane.getSelectedIndex();
    int maxIndex = tabPane.getTabCount() - 1;
    
    if ((selIndex == 0 && dir < 0) || (selIndex == maxIndex && dir > 0)) {
      selIndex = maxIndex - selIndex;
    } else {
      selIndex += dir;
    }
    
    if (0 <= selIndex && selIndex < tabPane.getTabCount()) {
      tabPane.setSelectedIndex(selIndex);
    }
  });
  
  // UIManager.put() is not enough
  this.setUI(new CustomMetalTabbedPaneUI());
  this.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, HelperUi.COLOR_COMPONENT_BORDER));
}

代码示例来源:origin: Audiveris/audiveris

/**
 * Report the index of last tab.
 *
 * @return the index of last tab
 */
public int getLastIndex ()
{
  return stubsPane.getTabCount() - 1;
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime

protected void setReverse(boolean reverse) {
    if (reverse) {
      index = tabs.getTabCount() - 1;
      increment = -1;
    } else {
      index = 0;
      increment = 1;
    }
    this.reverse = reverse;
  }
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

/**
 * returns the number of panels currently open
 * 
 * @return the number of open panels
 */
public int getPanelCount() {
 return tabbedPane.getTabCount();
}

代码示例来源:origin: chatty/chatty

/**
 * Switches to the next TAB, if available, or starts from the beginning.
 */
public void setSelectedNext() {
  int index = tabs.getSelectedIndex();
  int count = tabs.getTabCount();
  if (index+1 < count) {
    tabs.setSelectedIndex(index+1);
  } else if (count > 0) {
    tabs.setSelectedIndex(0);
  }
}

代码示例来源:origin: chatty/chatty

public void setSelectedPrevious() {
  int index = tabs.getSelectedIndex();
  int count = tabs.getTabCount();
  if (count > 0) {
    if (index-1 >= 0) {
      tabs.setSelectedIndex(index-1);
    } else {
      tabs.setSelectedIndex(count -1);
    }
  }
}

代码示例来源:origin: chatty/chatty

private boolean isNearLastTab(Point p) {
  Rectangle bounds = tabs.getBoundsAt(tabs.getTabCount() - 1);
  bounds.width += 99999;
  return bounds.contains(p);
}

代码示例来源:origin: igniterealtime/Spark

public SparkTab addTab(String title, Icon icon, final Component component,
    String tip) {
  final SparkTab sparktab = new SparkTab(this, component);
  TabPanel tabpanel = new TabPanel(sparktab, title, icon);
  pane.addTab(null, null, sparktab, tip);
  pane.setTabComponentAt(pane.getTabCount() - 1, tabpanel);
  fireTabAdded(sparktab, component, getTabPosition(sparktab));
  return sparktab;
}

代码示例来源:origin: igniterealtime/Spark

public void close(SparkTab sparktab) {
  int closeTabNumber = pane.indexOfComponent(sparktab);
  pane.removeTabAt(closeTabNumber);
  fireTabRemoved(sparktab, sparktab.getComponent(), closeTabNumber);
  if (pane.getTabCount() == 0) {
    allTabsClosed();
  }
}

相关文章

JTabbedPane类方法