/** * 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(); }
public boolean hasNext() { return index > -1 && index < self.getTabCount(); }
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); } } }
@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()); } } });
g2D.setColor(hazAlfa(getRunForTab(tabPane.getTabCount(), tabIndex) - 1)); g2D.fill(shape);
@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); } } } };
@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); } } } };
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); }
@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); } } }
SqlEngine.TAB_ERROR.setTitleAt(SqlEngine.TAB_ERROR.getTabCount() - 1, "<html><div style=\"text-align:left;width:150px;\">"+ methodError.getName() +"</div></html>");
int tabCount = tabbedPane.getTabCount(); for (int i = tabCount - 1; i >= 0; i--) { tabbedPane.remove(i);
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)); }
/** * Report the index of last tab. * * @return the index of last tab */ public int getLastIndex () { return stubsPane.getTabCount() - 1; }
protected void setReverse(boolean reverse) { if (reverse) { index = tabs.getTabCount() - 1; increment = -1; } else { index = 0; increment = 1; } this.reverse = reverse; } }
/** * returns the number of panels currently open * * @return the number of open panels */ public int getPanelCount() { return tabbedPane.getTabCount(); }
/** * 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); } }
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); } } }
private boolean isNearLastTab(Point p) { Rectangle bounds = tabs.getBoundsAt(tabs.getTabCount() - 1); bounds.width += 99999; return bounds.contains(p); }
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; }
public void close(SparkTab sparktab) { int closeTabNumber = pane.indexOfComponent(sparktab); pane.removeTabAt(closeTabNumber); fireTabRemoved(sparktab, sparktab.getComponent(), closeTabNumber); if (pane.getTabCount() == 0) { allTabsClosed(); } }