Java Code Examples for javax.swing.JTabbedPane

The following are top voted examples for showing how to use javax.swing.JTabbedPane. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: incubator-netbeans   File: RefactoringPanelContainer.java   View source code 6 votes vote down vote up
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();
        }
    }
}
 
Example 2
Project: incubator-netbeans   File: RefactoringPanelContainer.java   View source code 6 votes vote down vote up
@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();
    }
}
 
Example 3
Project: ants   File: MenuListener.java   View source code 6 votes vote down vote up
/**
 * {@link ChangeEvent} of the {@link #tabbedPane} (Menu: Single Player /
 * Duel / Tournament / About)
 */
@Override
public void stateChanged(ChangeEvent e) {
	if (e.getSource() instanceof JTabbedPane) {
		if (tabbedPane.getSelectedIndex() == 4) {
			if (buttonStart != null) {
				buttonStart.setEnabled(false);
			}
			if (runInBackgroundCheckbox != null) {
				runInBackgroundCheckbox.setEnabled(false);
			}
		} else {
			if (buttonStart != null) {
				buttonStart.setEnabled(true);
			}
			if (runInBackgroundCheckbox != null) {
				runInBackgroundCheckbox.setEnabled(true);
			}
		}
	}

}
 
Example 4
Project: incubator-netbeans   File: CollapsiblePanel.java   View source code 6 votes vote down vote up
public HookPanel(VCSCommitPanel master, Collection<? extends VCSHook> hooks, VCSHookContext hookContext) {            
    super(master, (hooks.size() == 1)
            ? hooks.iterator().next().getDisplayName()
            : getMessage("LBL_Advanced"), //NOI18N
            DEFAULT_DISPLAY_HOOKS);
    this.hooks = hooks;
    this.hookContext = hookContext;
    
    // need this to happen in addNotify() - depends on how 
    // repositoryComboSupport in hook.createComponents works for bugzilla|jira
    if (hooks.size() == 1) {                
        JPanel p = hooks.iterator().next().createComponent(hookContext);
        if (Boolean.TRUE.equals(p.getClientProperty("prop.requestOpened"))) { //NOI18N - some hook panels may want to be opened (hg queue hook with previously configured setts)
            super.displaySection();
        }
        sectionPanel.add(p);
    } else {
        JTabbedPane hooksTabbedPane = new JTabbedPane();
        for (VCSHook hook : hooks) {
            hooksTabbedPane.add(hook.createComponent(hookContext), hook.getDisplayName().replaceAll("\\&", ""));
        }
        sectionPanel.add(hooksTabbedPane);
    }
}
 
Example 5
Project: KernelHive   File: MainFrame.java   View source code 6 votes vote down vote up
private void initSidePane() {
	sidePane = new JTabbedPane(JTabbedPane.TOP);
	centerPane.setLeftComponent(sidePane);
	sidePane.setMinimumSize(new Dimension(180, 0));

	projectPanel = new JPanel();
	sidePane.addTab("Project", null, projectPanel, null);
	projectPanel.setLayout(new BorderLayout(0, 0));

	projectScrollPane = new JScrollPane();
	projectPanel.add(projectScrollPane, BorderLayout.CENTER);

	repositoryPanel = new JPanel();
	sidePane.addTab("Repository", null, repositoryPanel, null);
	repositoryPanel.setLayout(new BorderLayout(0, 0));

	repositoryScrollPane = new JScrollPane();
	repositoryPanel.add(repositoryScrollPane, BorderLayout.CENTER);
}
 
Example 6
Project: java-course   File: JNotepadPP.java   View source code 6 votes vote down vote up
/**
 * Creates new {@link JTabbedPane} with {@link ChangeListener}.
 */
private void tabbedPaneFactory() {
    tabs = new JTabbedPane();
    tabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    tabs.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            int index = tabs.getSelectedIndex();
            activeEditor = editors.get(index);
            if (editors.size() > 1) {
                activeEditor.updateStatusBar();
            }
            updateFrameTitle();
        }

    });
}
 
Example 7
Project: openjdk-jdk10   File: bug8017284.java   View source code 6 votes vote down vote up
public static void main(String[] args) throws Exception {

        Robot robot = new Robot();
        SwingUtilities.invokeAndWait(() -> {
            frame = new JFrame();
            frame.setSize(500, 500);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

            tabbedPane = new JTabbedPane();

            for (int i = 0; i < TAB_COUNT; i++) {
                tabbedPane.add("Header " + i, new JLabel("Content: " + i));
            }

            frame.getContentPane().setLayout(new BorderLayout());
            frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
            frame.setVisible(true);
        });

        robot.waitForIdle();

        SwingUtilities.invokeAndWait(() -> {
            for (int j = 0; j < ITERATIONS; j++) {
                for (int i = 0; i < TAB_COUNT; i++) {
                    tabbedPane.setTitleAt(i, getHtmlText(j * TAB_COUNT + i));
                }
            }
        });
        robot.waitForIdle();

        SwingUtilities.invokeAndWait(() -> frame.dispose());
    }
 
Example 8
Project: NovelJ   File: SettingsWindow_Windows.java   View source code 6 votes vote down vote up
/**
 * Initialize the contents of the frame.
 */
private void initialize() {
	frame = new JFrame();
	frame.setBounds(100, 100, 450, 300);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.getContentPane().setLayout(new GridLayout(1, 0, 0, 0));

	JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
	frame.getContentPane().add(tabbedPane);

	JScrollPane scrollPane = new JScrollPane();
	tabbedPane.addTab("New tab", null, scrollPane, null);

	JScrollPane scrollPane_1 = new JScrollPane();
	tabbedPane.addTab("New tab", null, scrollPane_1, null);
}
 
Example 9
Project: incubator-netbeans   File: DefaultDiffControllerProviderTest.java   View source code 6 votes vote down vote up
public void testTextualDiffContent () throws Exception {
    File diffFile = new File(getDataDir(), "enhancedview/diff");
    String goldenText = getFileContents(diffFile);
    goldenText = MessageFormat.format(goldenText, new Object[] {"a/", "b/"});

    final JTabbedPane tabbedPane = findTabbedPane(enhanced.getJComponent());
    JPanel p = (JPanel) tabbedPane.getComponentAt(1);
    tabbedPane.setSelectedIndex(1);
    JEditorPane pane = findEditorPane(p);
    assertFalse(pane == null);
    String text = pane.getText();
    for (int i = 0; i < 100; ++i) {
        if (!text.isEmpty()) {
            break;
        }
        Thread.sleep(100);
        text = pane.getText();
    }
    assertEquals(goldenText, text);
    EventQueue.invokeAndWait(new Runnable() {
        @Override
        public void run () {
            tabbedPane.setSelectedIndex(0);
        }
    });
}
 
Example 10
Project: incubator-netbeans   File: PluginManagerUI.java   View source code 6 votes vote down vote up
private void tpTabsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_tpTabsStateChanged
    Component component = ((JTabbedPane) evt.getSource ()).getSelectedComponent ();
    if (component instanceof SettingsTab) {
        int i = ((SettingsTab)component).getSelectedRow();
        ((SettingsTab)component).getSettingsTableModel ().refreshModel ();
        if (i > -1) {
            ((SettingsTab)component).setSelectedRow(i);
        }
        wasSettings = true;
    } else {
        if (wasSettings) {
            final UnitCategoryTableModel availableModel = (UnitCategoryTableModel) (availableTable).getModel ();
            final Map<String, Boolean> availableState = UnitCategoryTableModel.captureState (availableModel.getUnits ());
            ((SettingsTab) tpTabs.getComponentAt (INDEX_OF_SETTINGS_TAB)).doLazyRefresh (new Runnable () { // get SettingsTab
                @Override
                public void run () {
                    UnitCategoryTableModel.restoreState (availableModel.getUnits (), availableState, false);
                }
            });
        }
        wasSettings = false;
    }
}
 
Example 11
Project: incubator-netbeans   File: OptionsPanel.java   View source code 6 votes vote down vote up
private void computeOptionsWords() {
    Set<Map.Entry<String, CategoryModel.Category>> categories = categoryModel.getCategories();
    categoryid2tabs = new HashMap<String, HashMap<Integer, TabInfo>>();
    for (Map.Entry<String, CategoryModel.Category> set : categories) {
        JComponent jcomp = set.getValue().getComponent();
        String id = set.getValue().getID();
        if(jcomp instanceof JTabbedPane) {
            categoryid2tabbedpane.put(id, (JTabbedPane)jcomp);
        } else if(jcomp instanceof AdvancedPanel) {
            categoryid2tabbedpane.put(id, (JTabbedPane)jcomp.getComponent(0));
        } else if (jcomp instanceof Container) {
            handleAllComponents((Container) jcomp, id, null, -1);
        }
    }

    FileObject keywordsFOs = FileUtil.getConfigRoot().getFileObject(CategoryModel.OD_LAYER_KEYWORDS_FOLDER_NAME);

    for(FileObject keywordsFO : keywordsFOs.getChildren()) {
        handlePanel(keywordsFO);
    }
}
 
Example 12
Project: incubator-netbeans   File: OptionsPanel.java   View source code 6 votes vote down vote up
private void handleAllComponents(Container container, String categoryID, JTabbedPane tabbedPane, int index) {
    Component[] components = container.getComponents();
    Component component;
    for (int i = 0; i < components.length; i++) {
        component = components[i];
        String text;
        
        if(component instanceof JTabbedPane) {
            if(categoryid2tabbedpane.get(categoryID) == null) {
                categoryid2tabbedpane.put(categoryID, (JTabbedPane)component);
            }
        } else {
            handleAllComponents((Container)component, categoryID, tabbedPane, index);
        }
    }
    
}
 
Example 13
Project: incubator-netbeans   File: CodeTemplatesPanel.java   View source code 6 votes vote down vote up
private static void loc(JTabbedPane p, int tabIdx, String key, JEditorPane ep) {
    JLabel label = new JLabel(); // Only for setting tab names

    String tabName = loc("CTL_" + key); //NOI18N
    Mnemonics.setLocalizedText(label, tabName);
    p.setTitleAt(tabIdx, label.getText());

    int idx = Mnemonics.findMnemonicAmpersand(tabName);
    if (idx != -1 && idx + 1 < tabName.length()) {
        char ch = Character.toUpperCase(tabName.charAt(idx + 1));
        p.setMnemonicAt(tabIdx, ch);
        if (ep != null) {
            ep.setFocusAccelerator(ch);
        }
    }
}
 
Example 14
Project: Equella   File: DrmPageEditor.java   View source code 6 votes vote down vote up
@Override
@SuppressWarnings("nls")
public void init()
{
	setShowScripting(true);

	configTab = new DRMConfigTab();
	rightsTab = new DRMRightsTab();
	accessControlTab = new DRMAccessControlTab(getClientService().getService(RemoteUserService.class));
	requireAcceptanceFromTab = new DRMRequireAcceptanceFromTab();

	JTabbedPane tabs = new JTabbedPane();
	tabs.addTab(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drmpageeditor.config"), configTab);
	tabs.addTab(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drmpageeditor.rights"), rightsTab);
	tabs.addTab(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drmpageeditor.access"), accessControlTab);
	tabs.addTab(CurrentLocale.get("com.dytech.edge.admin.wizard.editor.drmpageeditor.requires"),
		requireAcceptanceFromTab);

	addSection(tabs);
}
 
Example 15
Project: jmeter-bzm-plugins   File: ViewResultsFullVisualizer.java   View source code 6 votes vote down vote up
/**
 * Initialize this visualizer
 * @throws ClassNotFoundException 
 * @throws IllegalAccessException 
 * @throws InstantiationException 
 */
private void init() {  // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    log.debug("init() - pass");
    setLayout(new BorderLayout(0, 5));
    setBorder(makeBorder());
    add(makeTitlePanel(), BorderLayout.NORTH);

    leftSide = createLeftPanel();
    // Prepare the common tab
    rightSide = new JTabbedPane();

    // Create the split pane
    mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSide, rightSide);
    mainSplit.setOneTouchExpandable(true);

    JSplitPane searchAndMainSP = new JSplitPane(JSplitPane.VERTICAL_SPLIT, 
            new SearchTreePanel(root), mainSplit);
    searchAndMainSP.setOneTouchExpandable(true);
    add(searchAndMainSP, BorderLayout.CENTER);
    // init right side with first render
    resultsRender.setRightSide(rightSide);
    resultsRender.init();
}
 
Example 16
Project: scorekeeperfrontend   File: QuickEntrySearch.java   View source code 6 votes vote down vote up
@Override
public void event(MT type, Object data)
{
    switch (type)
    {
        case QUICKID_SEARCH:
            if (getParent() instanceof JTabbedPane)
                ((JTabbedPane)getParent()).setSelectedComponent(this);
            entry.requestFocus();
        case EVENT_CHANGED:
        case ENTRANTS_CHANGED:
            cars.setRowSorter(null); // clear sorter so its listener based on old model size goes away
            cars.setModel(new EntryModel());
            TableColumnModel tcm = cars.getColumnModel();
            setColumnWidths(tcm.getColumn(0), 80, 160, 320);
            setColumnWidths(tcm.getColumn(1), 40, 80, 160);
            setColumnWidths(tcm.getColumn(2), 40, 80, 160);
            break;
    }
}
 
Example 17
Project: ramus   File: DFDObjectDialog.java   View source code 6 votes vote down vote up
public DFDObjectDialog(GUIFramework framework, DataPlugin dataPlugin) {
    super(framework.getMainFrame(), true);

    setTitle("dfd_object_options");

    this.dataPlugin = dataPlugin;
    this.framework = framework;

    JTabbedPane pane = new JTabbedPane();

    pane.addTab(ResourceLoader.getString("dfd_object"), createFirstTab(pane));
    pane.addTab(ResourceLoader.getString("font"), fontChooser);
    pane.addTab(ResourceLoader.getString("bk_color"),
            backgroundColorChooser);
    pane.addTab(ResourceLoader.getString("fg_color"),
            foregroundColorChooser);

    setMainPane(pane);

    ResourceLoader.setJComponentsText(this);

    this.pack();
    this.setMinimumSize(getSize());
    centerDialog();
    Options.loadOptions(this);
}
 
Example 18
Project: marathonv5   File: RComponentFactory.java   View source code 6 votes vote down vote up
public static void reset() {
    entries.clear();
    add(Component.class, RUnknownComponent.class);
    add(Window.class, RWindow.class);
    add(JTable.class, RTable.class);
    add(JTableHeader.class, RTableHeader.class);
    add(AbstractButton.class, RAbstractButton.class);
    add(JToggleButton.class, RToggleButton.class);
    add(JComboBox.class, RComboBox.class);
    add(JTextComponent.class, RTextComponent.class);
    add(JTree.class, RTree.class);
    add(JList.class, RList.class);
    add(JTabbedPane.class, RTabbedPane.class);
    add(JMenuItem.class, RMenuItem.class);
    add(JSlider.class, RSlider.class);
    add(JProgressBar.class, RProgressBar.class);
    add(JSpinner.class, RSpinner.class);
    add(DefaultEditor.class, RDefaultEditor.class);
    add(JColorChooser.class, RColorChooser.class);
    add(JSplitPane.class, RSplitPane.class);
    add(BasicSplitPaneDivider.class, RSplitPane.class);
    add(JFileChooser.class, RFileChooser.class);
    add(JEditorPane.class, REditorPane.class);
    add(JLabel.class, RLabel.class);
    add(JScrollBar.class, RIgnoreComponent.class);
}
 
Example 19
Project: marathonv5   File: JTabbedPaneJavaElementTest.java   View source code 6 votes vote down vote up
public void selectTabWithMultipleDuplicates() {
    siw(new Runnable() {

        @Override public void run() {
            JTabbedPane tp = (JTabbedPane) ComponentUtils.findComponent(JTabbedPane.class, frame);
            tp.addTab("Tab 2", icon, makeTextPanel("Panel #5"), "is a duplicate");
            tp.addTab("Tab 2", icon, makeTextPanel("Panel #6"), "is a duplicate");
        }
    });
    IJavaElement tabbedPane = driver.findElementByTagName("tabbed-pane");
    IJavaElement tab1 = tabbedPane.findElementByCssSelector(".::nth-tab(2)");
    tab1.click();
    AssertJUnit.assertEquals("1", tabbedPane.getAttribute("selectedIndex"));
    AssertJUnit.assertEquals("Tab 2", tab1.getText());

    IJavaElement tab2 = tabbedPane.findElementByCssSelector(".::nth-tab(5)");
    tab2.click();
    AssertJUnit.assertEquals("4", tabbedPane.getAttribute("selectedIndex"));
    AssertJUnit.assertEquals("Tab 2(1)", tab2.getText());

    IJavaElement tab3 = tabbedPane.findElementByCssSelector(".::nth-tab(6)");
    tab3.click();
    AssertJUnit.assertEquals("5", tabbedPane.getAttribute("selectedIndex"));
    AssertJUnit.assertEquals("Tab 2(2)", tab3.getText());
}
 
Example 20
Project: openjdk-jdk10   File: ScrollableTabbedPaneTest.java   View source code 6 votes vote down vote up
private static void createLeftUI(final String shortLAF)
        throws Exception {
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            frame = new JFrame(shortLAF);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
            pane = new JTabbedPane();
            pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
            pane.setTabPlacement(SwingConstants.LEFT);
            frame.add(pane);
            frame.setSize(500, 500);
        }
    });
}
 
Example 21
Project: alevin-svn2   File: PaneledGuiDemo.java   View source code 5 votes vote down vote up
@Override
protected JComponent createRightPane() {
	JTabbedPane tabs = new JTabbedPane();
	tabs.addTab("One", new SelectionPanel(graphpanel));
	tabs.addTab("Two", new JLabel("Two"));
	tabs.addTab("Three", new JLabel("Three"));
	tabs.setPreferredSize(new Dimension(80, 300));
	return tabs;
}
 
Example 22
Project: openjdk-jdk10   File: JTabbedPaneOperator.java   View source code 5 votes vote down vote up
/**
 * Maps {@code JTabbedPane.getComponentAt(int)} through queue
 */
public Component getComponentAt(final int i) {
    return (runMapping(new MapAction<Component>("getComponentAt") {
        @Override
        public Component map() {
            return ((JTabbedPane) getSource()).getComponentAt(i);
        }
    }));
}
 
Example 23
Project: VISNode   File: ExceptionPanel.java   View source code 5 votes vote down vote up
/**
 * Build tabs for the exceptions
 * 
 * @return JComponent
 */
private JComponent buildTabs() {
    JTabbedPane tabs = new JTabbedPane();
    for (Exception exception : exceptions) {
        if (tabs.getTabCount() > EXCEPTION_LIMIT) {
            tabs.add("And " + (exceptions.size() - EXCEPTION_LIMIT) + " more", Labels.create().icon(IconFactory.get().create("fa:frown-o")));
            break;
        }
        tabs.add(exception.getClass().getSimpleName(), buildExceptionPane(exception));
    }
    return tabs;
}
 
Example 24
Project: QN-ACTR-Release   File: StationParameterPanel.java   View source code 5 votes vote down vote up
private void initComponents() {
	this.setLayout(new BorderLayout(5, 5));
	mainPanel = new JTabbedPane();
	mainPanel.setBorder(title);

	// Adds a change listener to perform gotFocus() and lostFocus() calls on wizardPanels
	mainPanel.addChangeListener(new ChangeListener() {

		/**
		 * Invoked when the target of the listener has changed its state.
		 *
		 * @param e a ChangeEvent object
		 */
		public void stateChanged(ChangeEvent e) {
			// Lose focus on old panel
			if (current != null) {
				current.lostFocus();
			}
			// gets focus on new panel
			if (mainPanel.getSelectedComponent() != null) {
				current = (WizardPanel) mainPanel.getSelectedComponent();
				current.gotFocus();
			}
		}
	});
	add(mainPanel, BorderLayout.CENTER);
}
 
Example 25
Project: Logisim   File: LogFrame.java   View source code 5 votes vote down vote up
public LogFrame(Project project) {
	this.project = project;
	this.windowManager = new WindowMenuManager();
	project.addProjectListener(myListener);
	project.addLibraryListener(myListener);
	setDefaultCloseOperation(HIDE_ON_CLOSE);
	setJMenuBar(new LogisimMenuBar(this, project));
	setSimulator(project.getSimulator(), project.getCircuitState());

	panels = new LogPanel[] { new SelectionPanel(this), new ScrollPanel(this), new FilePanel(this), };
	tabbedPane = new JTabbedPane();
	for (int index = 0; index < panels.length; index++) {
		LogPanel panel = panels[index];
		tabbedPane.addTab(panel.getTitle(), null, panel, panel.getToolTipText());
	}

	JPanel buttonPanel = new JPanel();
	buttonPanel.add(clearLog);
	clearLog.addActionListener(myListener);

	Container contents = getContentPane();
	tabbedPane.setPreferredSize(new Dimension(450, 300));
	contents.add(tabbedPane, BorderLayout.CENTER);
	contents.add(buttonPanel, BorderLayout.SOUTH);

	LocaleManager.addLocaleListener(myListener);
	myListener.localeChanged();
	pack();
	setLocationRelativeTo(null);
}
 
Example 26
Project: marathonv5   File: JTabbedPaneJavaElementTest.java   View source code 5 votes vote down vote up
public void assertContentWithDuplicates() {
    IJavaElement tabbedPane = driver.findElementByTagName("tabbed-pane");
    siw(new Runnable() {
        @Override public void run() {
            JTabbedPane tp = (JTabbedPane) ComponentUtils.findComponent(JTabbedPane.class, frame);
            tp.setTitleAt(2, "Tab 2");
        }
    });
    AssertJUnit.assertEquals("[[\"Tab 1\",\"Tab 2\",\"Tab 2(1)\",\"Tab 4\"]]", tabbedPane.getAttribute("content"));
}
 
Example 27
Project: openjdk-jdk10   File: JTabbedPaneOperator.java   View source code 5 votes vote down vote up
/**
 * Maps {@code JTabbedPane.getSelectedIndex()} through queue
 */
public int getSelectedIndex() {
    return (runMapping(new MapIntegerAction("getSelectedIndex") {
        @Override
        public int map() {
            return ((JTabbedPane) getSource()).getSelectedIndex();
        }
    }));
}
 
Example 28
Project: OpenJSharp   File: MultiTabbedPaneUI.java   View source code 5 votes vote down vote up
/**
 * Invokes the <code>tabForCoordinate</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int tabForCoordinate(JTabbedPane a, int b, int c) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c);
    }
    return returnValue;
}
 
Example 29
Project: openjdk-jdk10   File: JTabbedPaneOperator.java   View source code 5 votes vote down vote up
@Override
public Hashtable<String, Object> getDump() {
    Hashtable<String, Object> result = super.getDump();
    if (((JTabbedPane) getSource()).getSelectedIndex() != -1) {
        result.put(SELECTED_PAGE_DPROP, ((JTabbedPane) getSource()).
                getTitleAt(((JTabbedPane) getSource()).getSelectedIndex()));
    }
    String[] pages = new String[((JTabbedPane) getSource()).getTabCount()];
    for (int i = 0; i < ((JTabbedPane) getSource()).getTabCount(); i++) {
        pages[i] = ((JTabbedPane) getSource()).getTitleAt(i);
    }
    addToDump(result, PAGE_PREFIX_DPROP, pages);
    return result;
}
 
Example 30
Project: jaer   File: Tmpdiff128.java   View source code 5 votes vote down vote up
/** @return a new panel for controlling this bias generator functionally
 */
@Override
public JPanel buildControlPanel() {
	JPanel panel = new JPanel();
	panel.setLayout(new BorderLayout());
	JTabbedPane pane = new JTabbedPane();

	pane.addTab("Biases", super.buildControlPanel());
	pane.addTab("User friendly controls", new Tmpdiff128FunctionalBiasgenPanel(Tmpdiff128.this));
	panel.add(pane, BorderLayout.CENTER);
	return panel;
}
 
Example 31
Project: openjdk-jdk10   File: MultiTabbedPaneUI.java   View source code 5 votes vote down vote up
/**
 * Invokes the <code>getTabRunCount</code> method on each UI handled by this object.
 *
 * @return the value obtained from the first UI, which is
 * the UI obtained from the default <code>LookAndFeel</code>
 */
public int getTabRunCount(JTabbedPane a) {
    int returnValue =
        ((TabbedPaneUI) (uis.elementAt(0))).getTabRunCount(a);
    for (int i = 1; i < uis.size(); i++) {
        ((TabbedPaneUI) (uis.elementAt(i))).getTabRunCount(a);
    }
    return returnValue;
}
 
Example 32
Project: incubator-netbeans   File: InnerTabsPanel.java   View source code 5 votes vote down vote up
private void fireChanged() {
    boolean isChanged = false;
    if (checkShowFolderName.isSelected() != settings.isShowFolderName()
            || checkShowFullPath.isSelected() != settings.isShowFullPath()
            || checkProjectColors.isSelected() != settings.isSameProjectSameColor()
            || checkSortDocumentList.isSelected() != settings.isSortDocumentListByProject()) {
        isChanged = true;
    }
    
    int rowCount = settings.getRowCount();
    if (checkMultiRow.isSelected() && radioRowCount.isSelected()) {
        rowCount = ((Number) spinRowCount.getValue()).intValue();
    }
    if (checkMultiRow.isSelected() != (rowCount > 1 || settings.isTabRowPerProject())) {
        isChanged = true;
    }
    if (rowCount != settings.getRowCount()) {
        isChanged = true;
    }
    if (radioRowPerProject.isSelected() != settings.isTabRowPerProject()) {
        isChanged = true;
    }
    
    if(radioPlacementBottom.isSelected() && settings.getTabsLocation() != JTabbedPane.BOTTOM
            || radioPlacementLeft.isSelected() && settings.getTabsLocation() != JTabbedPane.LEFT
            || radioPlacementRight.isSelected() && settings.getTabsLocation() != JTabbedPane.RIGHT
            || radioPlacementTop.isSelected() && settings.getTabsLocation() != JTabbedPane.TOP) {
        isChanged = true;
    }
    controller.changed(null, isChanged);
}
 
Example 33
Project: incubator-netbeans   File: TabDisplayerFactory.java   View source code 5 votes vote down vote up
@Override
public TabDisplayer createTabDisplayer( TabDataModel tabModel, int orientation ) {
    Settings settings = Settings.getDefault();
    boolean multiRow = settings.getRowCount() > 1 || settings.isTabRowPerProject();
    if( multiRow && (orientation == JTabbedPane.TOP || orientation == JTabbedPane.BOTTOM) ) {
        if( settings.isTabRowPerProject() ) {
            return new RowPerProjectTabDisplayer( tabModel, orientation );
        }
        return new MultiRowTabDisplayer( tabModel, orientation );
    }
    return new SimpleTabDisplayer( tabModel, orientation );
}
 
Example 34
Project: openjdk-jdk10   File: JTabbedPaneOperator.java   View source code 5 votes vote down vote up
/**
 * Maps {@code JTabbedPane.setEnabledAt(int, boolean)} through queue
 */
public void setEnabledAt(final int i, final boolean b) {
    runMapping(new MapVoidAction("setEnabledAt") {
        @Override
        public void map() {
            ((JTabbedPane) getSource()).setEnabledAt(i, b);
        }
    });
}
 
Example 35
Project: openjdk-jdk10   File: JTabbedPaneOperator.java   View source code 5 votes vote down vote up
/**
 * Maps {@code JTabbedPane.getTabCount()} through queue
 */
public int getTabCount() {
    return (runMapping(new MapIntegerAction("getTabCount") {
        @Override
        public int map() {
            return ((JTabbedPane) getSource()).getTabCount();
        }
    }));
}
 
Example 36
Project: incubator-netbeans   File: AbstractTabDisplayer.java   View source code 5 votes vote down vote up
@Override
public Insets getAutoscrollInsets() {
    if( orientation == JTabbedPane.HORIZONTAL ) {
        return new Insets( 0, 25, 0, 25 );
    } else {
        return new Insets( 25, 0, 25, 0 );
    }
}
 
Example 37
Project: JavaGraph   File: DisplaysPanel.java   View source code 5 votes vote down vote up
/** Indicates if a list panel should go onto the upper or the lower pane. */
private JTabbedPane getListsPanel(DisplayKind kind) {
    JTabbedPane result = null;
    switch (kind.getListPanel()) {
    case 0:
        result = getUpperListsPanel();
        break;
    case 1:
        result = getLowerListsPanel();
    }
    return result;
}
 
Example 38
Project: jreliability   File: MeasuresPanel.java   View source code 5 votes vote down vote up
/**
 * Initializes the {@link MeasuresPanel} by adding all single {@link MeasurePanel}s to a {@link JTabbedPane}.
 */
protected void initialize() {
	tabs = new JTabbedPane();
	for (Entry<String, ReliabilityFunction> entry : reliabilityFunctions.entrySet()) {
		String name = entry.getKey();
		ReliabilityFunction function = entry.getValue();
		MeasurePanel measurePanel = new MeasurePanel(function);
		tabs.addTab(name, measurePanel);
	}
	this.add(tabs);
	this.setBorder(
			BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Reliability-related Measures"),
					BorderFactory.createEmptyBorder(5, 0, 0, 0)));
}
 
Example 39
Project: bbm487s2017g1   File: LibrarianBookOperations.java   View source code 5 votes vote down vote up
/**
 * Initialize the contents of the frame.
 */
private void initialize(String username) {

    frame = new JFrame("Library Book Loan System - Librarian: " + username);
    frame.setResizable(false);
    frame.setBounds(100, 100, 586, 418);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    
    JPanel panel = new JPanel();
    frame.getContentPane().add(panel, BorderLayout.CENTER);
    panel.setLayout(null);
    
    JLabel label = new JLabel("Library Book Loan System");
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
    label.setBounds(10, 11, 564, 25);
    panel.add(label);
    
    JLabel lblBookOperations = new JLabel("Book Operations");
    lblBookOperations.setHorizontalAlignment(SwingConstants.CENTER);
    lblBookOperations.setFont(new Font("Segoe UI Light", Font.PLAIN, 14));
    lblBookOperations.setBounds(10, 40, 564, 22);
    panel.add(lblBookOperations);
    
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBackground(Color.LIGHT_GRAY);
    tabbedPane.setBounds(10, 73, 564, 295);
    panel.add(tabbedPane);


    initCreateTab(tabbedPane);
    initUpdateTab(tabbedPane);
    initDeleteTab(tabbedPane);
    initViewTab(tabbedPane);
}
 
Example 40
Project: Equella   File: ScriptEditor.java   View source code 5 votes vote down vote up
@Override
protected void setup()
{
	scriptTab = new ScriptTab(changeDetector);
	notificationsTab = new NotificationsTab(changeDetector, userService);
	final JTabbedPane tabs = new JTabbedPane();
	tabs.add(CurrentLocale.get("com.tle.admin.workflow.editor.scripteditor.details"), scriptTab);
	tabs.add(CurrentLocale.get("com.tle.admin.workflow.editor.stepeditor.notifications"), notificationsTab);

	setLayout(new GridLayout(1, 1));
	add(tabs);
}