List of usage examples for javax.swing JTabbedPane getTabComponentAt
public Component getTabComponentAt(int index)
index
. 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 ww w . ja v a 2 s .com*/ } 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()); }/* www . jav a 2s. co m*/ } updateFrameTitle(); }