List of usage examples for javax.swing JToolBar addSeparator
public void addSeparator()
From source file:de.tbuchloh.kiskis.gui.MainFramePanel.java
protected static void addActions(final JToolBar fileMenu, final Action[] actions) { for (int i = 0; i < actions.length; ++i) { if (actions[i] == null) { fileMenu.addSeparator(); } else {//from ww w. j a v a2 s .co m fileMenu.add(actions[i]); } } }
From source file:be.nbb.demetra.dfm.DfmExecViewTopComponent.java
@Override public JComponent getToolbarRepresentation() { JToolBar toolBar = NbComponents.newInnerToolbar(); toolBar.addSeparator(); toolBar.add(Box.createRigidArea(new Dimension(5, 0))); JToggleButton startStop = (JToggleButton) toolBar .add(new JToggleButton(StartStopCommand.INSTANCE.toAction(this))); startStop.setIcon(DemetraUiIcon.COMPILE_16); startStop.setDisabledIcon(createDisabledIcon(startStop.getIcon())); startStop.setToolTipText("Start/Stop"); JButton edit = toolBar.add(EditSpecCommand.INSTANCE.toAction(this)); edit.setIcon(DemetraUiIcon.PREFERENCES); edit.setDisabledIcon(createDisabledIcon(edit.getIcon())); edit.setToolTipText("Specification"); JButton clear = toolBar.add(ClearCommand.INSTANCE.toAction(this)); clear.setIcon(DemetraUiIcon.EDIT_CLEAR_16); clear.setDisabledIcon(createDisabledIcon(clear.getIcon())); clear.setToolTipText("Clear"); SwingColorSchemeSupport colorSchemeSupport = SwingColorSchemeSupport .from(DemetraUI.getInstance().getColorScheme()); sparkline = (ChartPanel) toolBar/*from ww w.j a v a2s .c o m*/ .add(Charts.avoidScaling(new ChartPanel(Charts.createSparkLineChart(null)))); sparkline.setPreferredSize(new Dimension(150, 16)); sparkline.setMaximumSize(new Dimension(150, 16)); sparkline.getChart().getXYPlot().setDataset(dataset); sparkline.getChart().getXYPlot().getRenderer() .setBasePaint(colorSchemeSupport.getLineColor(ColorScheme.KnownColor.GREEN)); sparkline.setBackground(colorSchemeSupport.getPlotColor()); sparkline.setBorder(BorderFactory.createLineBorder(colorSchemeSupport.getGridColor())); sparkline.setToolTipText("loglikelihood"); return toolBar; }
From source file:net.sf.jabref.gui.search.SearchBar.java
/** * Initializes the search bar.//from w w w . j a v a 2 s. com * * @param basePanel the base panel */ public SearchBar(BasePanel basePanel) { super(); this.basePanel = Objects.requireNonNull(basePanel); this.searchQueryHighlightObservable = new SearchQueryHighlightObservable(); currentResults.setFont(currentResults.getFont().deriveFont(Font.BOLD)); caseSensitive = new JToggleButton(IconTheme.JabRefIcon.CASE_SENSITIVE.getSmallIcon(), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_CASE_SENSITIVE)); caseSensitive.setToolTipText(Localization.lang("Case sensitive")); caseSensitive.addActionListener(e -> { performSearch(); updatePreferences(); }); regularExp = new JToggleButton(IconTheme.JabRefIcon.REG_EX.getSmallIcon(), Globals.prefs.getBoolean(JabRefPreferences.SEARCH_REG_EXP)); regularExp.setToolTipText(Localization.lang("regular expression")); regularExp.addActionListener(e -> { performSearch(); updatePreferences(); }); openCurrentResultsInDialog = new JButton(IconTheme.JabRefIcon.OPEN_IN_NEW_WINDOW.getSmallIcon()); openCurrentResultsInDialog.setToolTipText(Localization.lang("Show search results in a window")); openCurrentResultsInDialog.addActionListener(ae -> { SearchResultsDialog searchDialog = new SearchResultsDialog(basePanel.frame(), Localization.lang("Search results in database %0 for %1", basePanel.getBibDatabaseContext().getDatabaseFile().getName(), this.getSearchQuery().localize())); List<BibEntry> entries = basePanel.getDatabase().getEntries().stream().filter(BibEntry::isSearchHit) .collect(Collectors.toList()); searchDialog.addEntries(entries, basePanel); searchDialog.selectFirstEntry(); searchDialog.setVisible(true); }); openCurrentResultsInDialog.setEnabled(false); // Init controls setLayout(new WrapLayout(FlowLayout.LEFT)); searchIcon = new JLabel(IconTheme.JabRefIcon.SEARCH.getSmallIcon()); this.add(searchIcon); initSearchField(); if (OS.OS_X) { searchField.putClientProperty("JTextField.variant", "search"); } this.add(searchField); JButton clearSearchButton = new JButton(IconTheme.JabRefIcon.CLOSE.getSmallIcon()); clearSearchButton.setToolTipText(Localization.lang("Clear")); clearSearchButton.addActionListener(l -> endSearch()); this.add(clearSearchButton); searchModeButton = new JButton(); updateSearchModeButtonText(); searchModeButton.addActionListener(l -> toggleSearchModeAndSearch()); JToolBar toolBar = new OSXCompatibleToolbar(); toolBar.setFloatable(false); toolBar.add(clearSearchButton); toolBar.addSeparator(); toolBar.add(regularExp); toolBar.add(caseSensitive); toolBar.addSeparator(); toolBar.add(searchModeButton); toolBar.addSeparator(); toolBar.add(openCurrentResultsInDialog); globalSearch = new JButton(Localization.lang("Search globally")); globalSearch.setToolTipText(Localization.lang("Search in all open databases")); globalSearch.addActionListener(l -> { AbstractWorker worker = new GlobalSearchWorker(basePanel.frame(), getSearchQuery()); worker.run(); worker.update(); }); globalSearch.setEnabled(false); toolBar.add(globalSearch); toolBar.addSeparator(); toolBar.add(new HelpAction(HelpFile.SEARCH)); this.add(toolBar); this.add(currentResults); paintBackgroundWhite(this); }
From source file:net.sf.jabref.gui.PreviewPanel.java
private JToolBar createToolBar() { JToolBar toolBar = new OSXCompatibleToolbar(SwingConstants.VERTICAL); toolBar.setMargin(new Insets(0, 0, 0, 2)); toolBar.setFloatable(false);// w w w.j a v a 2 s .c o m // Add actions (and thus buttons) toolBar.add(this.closeAction); toolBar.addSeparator(); toolBar.add(this.copyPreviewAction); toolBar.addSeparator(); toolBar.add(this.printAction); Component[] comps = toolBar.getComponents(); for (Component comp : comps) { ((JComponent) comp).setOpaque(false); } return toolBar; }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakAnnotationCalibrationPanel.java
private JToolBar createToolBarEdit() { JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false);/*from w w w . j a va 2 s . c o m*/ toolbar.addSeparator(); toolbar.add(theActionManager.get("arrow")); toolbar.add(theActionManager.get("hand")); toolbar.addSeparator(); toolbar.add(theActionManager.get("zoomnone")); toolbar.add(theActionManager.get("zoomin")); toolbar.add(theActionManager.get("zoomout")); return toolbar; }
From source file:ToolBarDemo2.java
protected void addButtons(JToolBar toolBar) { JButton button = null;//from ww w. j a va 2 s . com //first button button = makeNavigationButton("Back24", PREVIOUS, "Back to previous something-or-other", "Previous"); toolBar.add(button); //second button button = makeNavigationButton("Up24", UP, "Up to something-or-other", "Up"); toolBar.add(button); //third button button = makeNavigationButton("Forward24", NEXT, "Forward to something-or-other", "Next"); toolBar.add(button); //separator toolBar.addSeparator(); //fourth button button = new JButton("Another button"); button.setActionCommand(SOMETHING_ELSE); button.setToolTipText("Something else"); button.addActionListener(this); toolBar.add(button); //fifth component is NOT a button! JTextField textField = new JTextField("A text field"); textField.setColumns(10); textField.addActionListener(this); textField.setActionCommand(TEXT_ENTERED); toolBar.add(textField); }
From source file:daylightchart.gui.DaylightChartGui.java
private void createHelpMenu(final JMenuBar menuBar, final JToolBar toolBar) { final GuiAction onlineHelp = new OnlineHelpAction(); final GuiAction about = new AboutAction(DaylightChartGui.this); final JMenu menuHelp = new JMenu(Messages.getString("DaylightChartGui.Menu.Help")); //$NON-NLS-1$ menuHelp.setMnemonic('H'); menuHelp.add(onlineHelp);//w ww. jav a2s .c o m menuHelp.add(about); menuBar.add(menuHelp); toolBar.addSeparator(); toolBar.add(onlineHelp); }
From source file:com.mgmtp.jfunk.core.ui.JFunkFrame.java
private void buildToolBar() { // Toolbar for the first line JToolBar toolBarFirstLine = new JToolBar("Toolbar"); toolBarFirstLine.setRequestFocusEnabled(false); toolBarFirstLine.setFloatable(false); toolBarFirstLine.add(fileOpenScriptsAction); toolBarFirstLine.add(toolsRunAction); toolBarFirstLine.addSeparator(); // Build component jFunk property files jFunkPropertyFilesModel = new PropertiesComboBoxModel("config", "jfunk", PROPS_SUFFIX, null, true); jFunkPropertyFilesComboBox = new JComboBox(jFunkPropertyFilesModel); jFunkPropertyFilesComboBox.setBorder(BorderFactory.createTitledBorder("jFunk configuration")); // Multi-line tooltip jFunkPropertyFilesComboBox/* ww w .ja v a 2 s .c om*/ .setToolTipText("<html>List of jFunk property files containing listener and modules" + "<br>Location: all files in directory 'config'</br></html>"); toolBarFirstLine.add(jFunkPropertyFilesComboBox); // Build component testsystems testSystemsModel = new PropertiesComboBoxModel("config/system", null, PROPS_SUFFIX, "baseurl", false); testSystemsComboBox = new JComboBox(testSystemsModel); testSystemsComboBox.setBorder(BorderFactory.createTitledBorder("Test system")); // Multi-line tooltip testSystemsComboBox.setToolTipText( "<html>List of test systems" + "<br>Defined by all files in directory 'config/system'</br></html>"); testSystemsComboBox.setSelectedItem(0); toolBarFirstLine.add(testSystemsComboBox); // Toolbar for the second line JToolBar toolBarSecondLine = new JToolBar(); toolBarSecondLine.setRequestFocusEnabled(false); toolBarSecondLine.setFloatable(false); // Build component mail configuration mailConfigurationsModel = new PropertiesComboBoxModel(PATH_TO_MAIL_CONFIG_FILES, null, PROPS_SUFFIX, null, false); mailConfigurationsComboBox = new JComboBox(mailConfigurationsModel); mailConfigurationsComboBox.setBorder(BorderFactory.createTitledBorder("Mail configuration")); // Multi-line tooltip mailConfigurationsComboBox.setToolTipText("<html>List of mail configurations" + "<br>Defined by all files in directory 'config/email_accounts'</br></html>"); toolBarSecondLine.add(mailConfigurationsComboBox); // Build component thread count threadCountComboBox = new JComboBox(createNumberArray(30)); threadCountComboBox.setBorder(BorderFactory.createTitledBorder("Threads")); threadCountComboBox.setToolTipText( "Number of threads which will be used for the execution of the selected script files"); toolBarSecondLine.add(threadCountComboBox); // Build component parallel parallelComboBox = new JComboBox(new String[] { "yes", "no" }); parallelComboBox.setSelectedIndex(1); parallelComboBox.setBorder(BorderFactory.createTitledBorder("Parallel?")); parallelComboBox.setToolTipText("If set to 'yes', a single script will be executed " + "multiple times using the specified number of threads"); toolBarSecondLine.add(parallelComboBox); jPanelUtilities = new JPanel(); jPanelUtilities.setLayout(new BorderLayout()); jPanelUtilities.add(toolBarFirstLine, BorderLayout.NORTH); jPanelUtilities.add(toolBarSecondLine, BorderLayout.CENTER); }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.AnnotationReportApplet.java
private JToolBar createToolBar() { JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false);/*from w w w. j ava 2s .co m*/ toolbar.add(theActionManager.get("print")); toolbar.addSeparator(); toolbar.add(theActionManager.get("undo")); toolbar.add(theActionManager.get("redo")); toolbar.addSeparator(); toolbar.add(theActionManager.get("cut")); toolbar.add(theActionManager.get("copy")); toolbar.add(theActionManager.get("delete")); toolbar.add(theActionManager.get("screenshot")); toolbar.addSeparator(); toolbar.add(theActionManager.get("enlarge")); toolbar.add(theActionManager.get("resetsize")); toolbar.add(theActionManager.get("shrink")); toolbar.addSeparator(); toolbar.add(theActionManager.get("zoomnone")); toolbar.add(theActionManager.get("zoomin")); toolbar.add(theActionManager.get("zoomout")); toolbar.addSeparator(); toolbar.add(theActionManager.get("orientation")); return toolbar; }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakAnnotationCalibrationPanel.java
private JToolBar createToolBarDocument() { JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false);/*from w w w. j a v a 2s . co m*/ toolbar.add(theActionManager.get("last")); toolbar.add(theActionManager.get("close")); toolbar.add(theActionManager.get("next")); toolbar.addSeparator(); toolbar.add(accunit_button = new JButton(theActionManager.get("accunit=ppm"))); accunit_button.setText(null); toolbar.add(theActionManager.get("new")); toolbar.addSeparator(); toolbar.add(theActionManager.get("print")); //toolbar.addSeparator(); //toolbar.add(theActionManager.get("undo")); //toolbar.add(theActionManager.get("redo")); return toolbar; }