List of usage examples for javax.swing JTabbedPane getTabCount
@BeanProperty(bound = false) public int getTabCount()
tabbedpane
. From source file:org.pentaho.reporting.designer.core.ReportDesignerFrame.java
private void rebuildReportMenu() { final XulComponent reopenMenu = context.getView().getXulComponent("window.reports-area", XulComponent.class); if (reopenMenu == null) { return;//from w w w.j a va2s. c o m } final List<XulComponent> xulComponents = reopenMenu.getChildNodes(); final XulComponent[] objects = xulComponents.toArray(new XulComponent[xulComponents.size()]); for (int i = 0; i < objects.length; i++) { final XulComponent object = objects[i]; reopenMenu.removeChild(object); } final JTabbedPane tabbedPane = getReportEditorPane(); final int count = tabbedPane.getTabCount(); if (count > 0) { reopenMenu.addChild(new SwingMenuseparator(null, null, null, "menu-separator")); // NON-NLS for (int i = 0; i < count; i++) { final Component at = tabbedPane.getTabComponentAt(i); final String tabName; if (at instanceof TabRenderer) { final TabRenderer renderer = (TabRenderer) at; tabName = renderer.getTitle(); } else { tabName = tabbedPane.getTitleAt(i); } final SelectTabAction action = new SelectTabAction(i, tabName); final ActionSwingMenuitem actionSwingMenuitem = context.getView().createMenuItem(action); actionSwingMenuitem.setReportDesignerContext(context); reopenMenu.addChild(actionSwingMenuitem); } } }
From source file:org.pentaho.reporting.designer.core.ReportDesignerFrame.java
private void recomputeAllTabTitles() { final JTabbedPane editorPane = getReportEditorPane(); final int count = editorPane.getTabCount(); for (int i = 0; i < count; i++) { final Component at = editorPane.getTabComponentAt(i); if (at instanceof TabRenderer) { final TabRenderer renderer = (TabRenderer) at; renderer.setTitle(renderer.recomputeTabName()); }//from w w w.ja v a2 s.c o m } updateFrameTitle(); }
From source file:org.springframework.richclient.factory.DefaultComponentFactory.java
public void addConfiguredTab(JTabbedPane tabbedPane, String labelKey, JComponent tabComponent) { org.springframework.richclient.core.LabelInfo info = getLabelInfo(getRequiredMessage(labelKey)); tabbedPane.addTab(info.getText(), tabComponent); int tabIndex = tabbedPane.getTabCount() - 1; tabbedPane.setMnemonicAt(tabIndex, info.getMnemonic()); tabbedPane.setDisplayedMnemonicIndexAt(tabIndex, info.getMnemonicIndex()); tabbedPane.setIconAt(tabIndex, getIcon(labelKey)); tabbedPane.setToolTipTextAt(tabIndex, getCaption(labelKey)); }
From source file:pl.otros.logview.api.OtrosApplication.java
public void addClosableTab(String name, String tooltip, Icon icon, JComponent component, boolean show) { JTabbedPane tabbedPane = getJTabbedPane(); if (tabbedPane.indexOfComponent(component) == -1) { int tabCount = tabbedPane.getTabCount(); tabbedPane.addTab(name, icon, component); tabbedPane.setTabComponentAt(tabCount, new TabHeader(tabbedPane, name, icon, tooltip)); tabbedPane.setSelectedIndex(tabCount); }/*ww w. j a v a 2s . c o m*/ if (show) { tabbedPane.setSelectedComponent(component); } }
From source file:plugin.notes.NotesPlugin.java
/** * Changes to the notes plugin as the active tab * * @param evt/*from w w w . j av a 2 s.c o m*/ * Action Event of a click on the tool menu item */ private static void toolMenuItem(ActionEvent evt) { JTabbedPane tp = GMGenSystemView.getTabPane(); IntStream.range(0, tp.getTabCount()).filter(i -> tp.getComponentAt(i) instanceof NotesView) .forEach(tp::setSelectedIndex); }