Example usage for javax.swing JToolBar addSeparator

List of usage examples for javax.swing JToolBar addSeparator

Introduction

In this page you can find the example usage for javax.swing JToolBar addSeparator.

Prototype

public void addSeparator() 

Source Link

Document

Appends a separator of default size to the end of the tool bar.

Usage

From source file:fll.scheduler.SchedulerUI.java

private JToolBar createDescriptionToolbar() {
    final JToolBar toolbar = new JToolBar("Description Toolbar");
    toolbar.setFloatable(false);//from   w  w  w.j a v  a2  s.com

    toolbar.add(mDescriptionFilename);
    toolbar.addSeparator();
    toolbar.add(mNewScheduleDescriptionAction);
    toolbar.add(mOpenScheduleDescriptionAction);
    toolbar.add(mSaveScheduleDescriptionAction);
    toolbar.add(mRunSchedulerAction);

    return toolbar;
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.SpectraPanel.java

private JToolBar createToolBar() {
    JToolBar toolbar = new JToolBar();
    toolbar.setFloatable(false);/*from w  w w.  j a  va2s . c om*/

    toolbar.add(theActionManager.get("previous"));
    toolbar.add(theActionManager.get("close"));
    toolbar.add(theActionManager.get("next"));

    toolbar.addSeparator();

    toolbar.add(theActionManager.get("new"));
    toolbar.add(theActionManager.get("openspectra"));
    toolbar.add(theActionManager.get("edit"));

    toolbar.addSeparator();

    toolbar.add(theActionManager.get("print"));

    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"));

    toolbar.addSeparator();

    toolbar.add(mslevel_button = new JButton(theActionManager.get("mslevel=msms")));
    mslevel_button.setText(null);
    toolbar.add(theActionManager.get("addpeaks"));
    toolbar.add(theActionManager.get("annotatepeaks"));

    toolbar.addSeparator();

    toolbar.add(theActionManager.get("noisefilter"));
    toolbar.add(theActionManager.get("baselinecorrection"));
    toolbar.add(theActionManager.get("centroid"));
    toolbar.add(isotopes_button = new JButton(theActionManager.get("updateisotopecurves=false")));
    isotopes_button.setText(null);
    toolbar.add(ftmode_button = new JButton(theActionManager.get("showallisotopes=true")));
    ftmode_button.setText(null);

    return toolbar;
}

From source file:net.sf.jabref.gui.preftabs.TableColumnsTab.java

/**
 * Customization of external program paths.
 *
 * @param prefs a <code>JabRefPreferences</code> value
 *//*w  ww  . j  ava2 s.c  om*/
public TableColumnsTab(JabRefPreferences prefs, JabRefFrame frame) {
    this.prefs = prefs;
    this.frame = frame;
    setLayout(new BorderLayout());

    TableModel tm = new AbstractTableModel() {

        @Override
        public int getRowCount() {
            return rowCount;
        }

        @Override
        public int getColumnCount() {
            return 2;
        }

        @Override
        public Object getValueAt(int row, int column) {
            int internalRow = row;
            if (internalRow == 0) {
                return column == 0 ? InternalBibtexFields.NUMBER_COL : String.valueOf(ncWidth);
            }
            internalRow--;
            if (internalRow >= tableRows.size()) {
                return "";
            }
            Object rowContent = tableRows.get(internalRow);
            if (rowContent == null) {
                return "";
            }
            TableRow tr = (TableRow) rowContent;
            // Only two columns
            if (column == 0) {
                return tr.getName();
            } else {
                return tr.getLength() > 0 ? Integer.toString(tr.getLength()) : "";
            }
        }

        @Override
        public String getColumnName(int col) {
            return col == 0 ? Localization.lang("Field name") : Localization.lang("Column width");
        }

        @Override
        public Class<?> getColumnClass(int column) {
            if (column == 0) {
                return String.class;
            }
            return Integer.class;
        }

        @Override
        public boolean isCellEditable(int row, int col) {
            return !((row == 0) && (col == 0));
        }

        @Override
        public void setValueAt(Object value, int row, int col) {
            tableChanged = true;
            // Make sure the vector is long enough.
            while (row >= tableRows.size()) {
                tableRows.add(new TableRow("", -1));
            }

            if ((row == 0) && (col == 1)) {
                ncWidth = Integer.parseInt(value.toString());
                return;
            }

            TableRow rowContent = tableRows.get(row - 1);

            if (col == 0) {
                rowContent.setName(value.toString());
                if ("".equals(getValueAt(row, 1))) {
                    setValueAt(String.valueOf(BibtexSingleField.DEFAULT_FIELD_LENGTH), row, 1);
                }
            } else {
                if (value == null) {
                    rowContent.setLength(-1);
                } else {
                    rowContent.setLength(Integer.parseInt(value.toString()));
                }
            }
        }

    };

    colSetup = new JTable(tm);
    TableColumnModel cm = colSetup.getColumnModel();
    cm.getColumn(0).setPreferredWidth(140);
    cm.getColumn(1).setPreferredWidth(80);

    FormLayout layout = new FormLayout("1dlu, 8dlu, left:pref, 4dlu, fill:pref", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    JPanel pan = new JPanel();
    JPanel tabPanel = new JPanel();
    tabPanel.setLayout(new BorderLayout());
    JScrollPane sp = new JScrollPane(colSetup, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    colSetup.setPreferredScrollableViewportSize(new Dimension(250, 200));
    sp.setMinimumSize(new Dimension(250, 300));
    tabPanel.add(sp, BorderLayout.CENTER);
    JToolBar toolBar = new OSXCompatibleToolbar(SwingConstants.VERTICAL);
    toolBar.setFloatable(false);
    AddRowAction addRow = new AddRowAction();
    DeleteRowAction deleteRow = new DeleteRowAction();
    MoveRowUpAction moveUp = new MoveRowUpAction();
    MoveRowDownAction moveDown = new MoveRowDownAction();
    toolBar.setBorder(null);
    toolBar.add(addRow);
    toolBar.add(deleteRow);
    toolBar.addSeparator();
    toolBar.add(moveUp);
    toolBar.add(moveDown);
    tabPanel.add(toolBar, BorderLayout.EAST);

    fileColumn = new JCheckBox(Localization.lang("Show file column"));
    urlColumn = new JCheckBox(Localization.lang("Show URL/DOI column"));
    preferUrl = new JRadioButton(Localization.lang("Show URL first"));
    preferDoi = new JRadioButton(Localization.lang("Show DOI first"));
    ButtonGroup preferUrlDoiGroup = new ButtonGroup();
    preferUrlDoiGroup.add(preferUrl);
    preferUrlDoiGroup.add(preferDoi);

    urlColumn.addChangeListener(arg0 -> {
        preferUrl.setEnabled(urlColumn.isSelected());
        preferDoi.setEnabled(urlColumn.isSelected());
    });
    arxivColumn = new JCheckBox(Localization.lang("Show ArXiv column"));

    Collection<ExternalFileType> fileTypes = ExternalFileTypes.getInstance().getExternalFileTypeSelection();
    String[] fileTypeNames = new String[fileTypes.size()];
    int i = 0;
    for (ExternalFileType fileType : fileTypes) {
        fileTypeNames[i++] = fileType.getName();
    }
    listOfFileColumns = new JList<>(fileTypeNames);
    JScrollPane listOfFileColumnsScrollPane = new JScrollPane(listOfFileColumns);
    listOfFileColumns.setVisibleRowCount(3);
    extraFileColumns = new JCheckBox(Localization.lang("Show extra columns"));
    extraFileColumns.addChangeListener(arg0 -> listOfFileColumns.setEnabled(extraFileColumns.isSelected()));

    /*** begin: special table columns and special fields ***/

    JButton helpButton = new HelpAction(Localization.lang("Help on special fields"), HelpFile.SPECIAL_FIELDS)
            .getHelpButton();

    rankingColumn = new JCheckBox(Localization.lang("Show rank"));
    qualityColumn = new JCheckBox(Localization.lang("Show quality"));
    priorityColumn = new JCheckBox(Localization.lang("Show priority"));
    relevanceColumn = new JCheckBox(Localization.lang("Show relevance"));
    printedColumn = new JCheckBox(Localization.lang("Show printed status"));
    readStatusColumn = new JCheckBox(Localization.lang("Show read status"));

    // "sync keywords" and "write special" fields may be configured mutually exclusive only
    // The implementation supports all combinations (TRUE+TRUE and FALSE+FALSE, even if the latter does not make sense)
    // To avoid confusion, we opted to make the setting mutually exclusive
    syncKeywords = new JRadioButton(Localization.lang("Synchronize with keywords"));
    writeSpecialFields = new JRadioButton(
            Localization.lang("Write values of special fields as separate fields to BibTeX"));
    ButtonGroup group = new ButtonGroup();
    group.add(syncKeywords);
    group.add(writeSpecialFields);

    specialFieldsEnabled = new JCheckBox(Localization.lang("Enable special fields"));
    specialFieldsEnabled.addChangeListener(event -> {
        boolean isEnabled = specialFieldsEnabled.isSelected();
        rankingColumn.setEnabled(isEnabled);
        qualityColumn.setEnabled(isEnabled);
        priorityColumn.setEnabled(isEnabled);
        relevanceColumn.setEnabled(isEnabled);
        printedColumn.setEnabled(isEnabled);
        readStatusColumn.setEnabled(isEnabled);
        syncKeywords.setEnabled(isEnabled);
        writeSpecialFields.setEnabled(isEnabled);
    });

    builder.appendSeparator(Localization.lang("Special table columns"));
    builder.nextLine();
    builder.append(pan);

    DefaultFormBuilder specialTableColumnsBuilder = new DefaultFormBuilder(
            new FormLayout("8dlu, 8dlu, 8cm, 8dlu, 8dlu, left:pref:grow",
                    "pref, pref, pref, pref, pref, pref, pref, pref, pref, pref, pref, pref, pref"));
    CellConstraints cc = new CellConstraints();

    specialTableColumnsBuilder.add(specialFieldsEnabled, cc.xyw(1, 1, 3));
    specialTableColumnsBuilder.add(rankingColumn, cc.xyw(2, 2, 2));
    specialTableColumnsBuilder.add(relevanceColumn, cc.xyw(2, 3, 2));
    specialTableColumnsBuilder.add(qualityColumn, cc.xyw(2, 4, 2));
    specialTableColumnsBuilder.add(priorityColumn, cc.xyw(2, 5, 2));
    specialTableColumnsBuilder.add(printedColumn, cc.xyw(2, 6, 2));
    specialTableColumnsBuilder.add(readStatusColumn, cc.xyw(2, 7, 2));
    specialTableColumnsBuilder.add(syncKeywords, cc.xyw(2, 10, 2));
    specialTableColumnsBuilder.add(writeSpecialFields, cc.xyw(2, 11, 2));
    specialTableColumnsBuilder.add(helpButton, cc.xyw(1, 12, 2));

    specialTableColumnsBuilder.add(fileColumn, cc.xyw(5, 1, 2));
    specialTableColumnsBuilder.add(urlColumn, cc.xyw(5, 2, 2));
    specialTableColumnsBuilder.add(preferUrl, cc.xy(6, 3));
    specialTableColumnsBuilder.add(preferDoi, cc.xy(6, 4));
    specialTableColumnsBuilder.add(arxivColumn, cc.xyw(5, 5, 2));

    specialTableColumnsBuilder.add(extraFileColumns, cc.xyw(5, 6, 2));
    specialTableColumnsBuilder.add(listOfFileColumnsScrollPane, cc.xywh(5, 7, 2, 6));

    builder.append(specialTableColumnsBuilder.getPanel());
    builder.nextLine();

    /*** end: special table columns and special fields ***/

    builder.appendSeparator(Localization.lang("Entry table columns"));
    builder.nextLine();
    builder.append(pan);
    builder.append(tabPanel);
    builder.nextLine();
    builder.append(pan);
    JButton buttonWidth = new JButton(new UpdateWidthsAction());
    JButton buttonOrder = new JButton(new UpdateOrderAction());
    builder.append(buttonWidth);
    builder.nextLine();
    builder.append(pan);
    builder.append(buttonOrder);
    builder.nextLine();
    builder.append(pan);
    builder.nextLine();
    pan = builder.getPanel();
    pan.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(pan, BorderLayout.CENTER);
}

From source file:de.unibayreuth.bayeos.goat.panels.timeseries.JPanelChart.java

private JToolBar createChartToolbar() {
    JToolBar toolbar = new JToolBar();

    ButtonGroup groupedButtons = new ButtonGroup();

    // ACTION_CMD_PAN
    chartPanButton = new JToggleButton();
    prepareButton(chartPanButton, ACTION_CHART_PAN, "de/unibayreuth/bayeos/goat/panels/Pan16.gif", "Pan mode");
    groupedButtons.add(chartPanButton);/*from   ww w .j  av  a 2 s .  co  m*/
    toolbar.add(chartPanButton);

    // ACTION_CMD_ZOOM_BOX
    chartZoomButton = new JToggleButton();
    prepareButton(chartZoomButton, ACTION_CHART_ZOOM_BOX, "de/unibayreuth/bayeos/goat/panels/Zoom16.gif",
            "Zoom mode");
    groupedButtons.add(chartZoomButton);
    chartZoomButton.setSelected(true); // no other makes sense after startup
    toolbar.add(chartZoomButton);

    // end of toggle-button group for select/pan/zoom-box
    toolbar.addSeparator();

    // ACTION_CMD_ZOOM_IN
    chartZoomInButton = new JButton();
    prepareButton(chartZoomInButton, ACTION_CHART_ZOOM_IN, "de/unibayreuth/bayeos/goat/panels/ZoomIn16.gif",
            "Zoom in");
    toolbar.add(chartZoomInButton);

    // ACTION_CMD_ZOOM_OUT
    chartZoomOutButton = new JButton();
    prepareButton(chartZoomOutButton, ACTION_CHART_ZOOM_OUT, "de/unibayreuth/bayeos/goat/panels/ZoomOut16.gif",
            "Zoom out");
    toolbar.add(chartZoomOutButton);

    // ACTION_CMD_ZOOM_TO_FIT
    chartFitButton = new JButton();
    prepareButton(chartFitButton, ACTION_CHART_ZOOM_TO_FIT,
            "de/unibayreuth/bayeos/goat/panels/ZoomExtent16.gif", "Zoom to extent");
    toolbar.add(chartFitButton);

    toolbar.addSeparator();

    chartExportButton = new JButton();
    prepareButton(chartExportButton, ACTION_CHART_EXPORT, "de/unibayreuth/bayeos/goat/panels/Export16.gif",
            "Export chart image ...");
    toolbar.add(chartExportButton);

    // ACTION_CMD_PRINT
    chartPrintButton = new JButton();
    prepareButton(chartPrintButton, ACTION_CHART_PRINT, "de/unibayreuth/bayeos/goat/panels/Print16.gif",
            "Print chart ...");
    toolbar.add(chartPrintButton);

    toolbar.addSeparator();
    // ACTION_CMD_PROPERTIES
    chartPropertiesButton = new JButton();
    prepareButton(chartPropertiesButton, ACTION_CHART_PROPERTIES,
            "de/unibayreuth/bayeos/goat/panels/Properties16.gif", "Chart properties ...");
    toolbar.add(chartPropertiesButton);

    chartZoomOutButton.setEnabled(false);
    chartFitButton.setEnabled(false);

    return toolbar;
}

From source file:ch.fork.AdHocRailway.ui.AdHocRailway.java

private void initToolbar() {
    /* FILE *//*from www  .j av a 2  s  . co m*/
    final JToolBar fileToolBar = new JToolBar();

    final JButton newFileToolBarButton = new SmallToolbarButton(new NewFileAction());
    final JButton openFileToolBarButton = new SmallToolbarButton(new OpenFileAction());
    final JButton openDatabaseToolBarButton = new SmallToolbarButton(new OpenDatabaseAction());
    final JButton saveToolBarButton = new SmallToolbarButton(new SaveAction());
    final JButton exitToolBarButton = new SmallToolbarButton(new ExitAction());

    fileToolBar.add(newFileToolBarButton);
    fileToolBar.add(openFileToolBarButton);
    fileToolBar.add(openDatabaseToolBarButton);
    fileToolBar.add(saveToolBarButton);
    fileToolBar.add(exitToolBarButton);

    /* DIGITAL */
    final JToolBar digitalToolBar = new JToolBar();
    turnoutsToolBarButton = new SmallToolbarButton(new TurnoutAction());
    routesToolBarButton = new SmallToolbarButton(new RoutesAction());
    locomotivesToolBarButton = new SmallToolbarButton(new LocomotivesAction());
    preferencesToolBarButton = new SmallToolbarButton(new PreferencesAction());

    digitalToolBar.add(turnoutsToolBarButton);
    digitalToolBar.add(routesToolBarButton);
    digitalToolBar.add(locomotivesToolBarButton);
    digitalToolBar.add(preferencesToolBarButton);

    /* SRCP / AdHoc-Brain */
    final JToolBar daemonToolBar = new JToolBar();
    railwayDeviceLabelLabel = new JLabel();

    setRailwayDeviceLabelText();
    connectToolBarButton = new SmallToolbarButton(new ConnectAction());
    disconnectToolBarButton = new SmallToolbarButton(new DisconnectAction());
    disconnectToolBarButton.setEnabled(false);

    daemonToolBar.add(railwayDeviceLabelLabel);
    daemonToolBar.addSeparator();
    daemonToolBar.add(connectToolBarButton);
    daemonToolBar.add(disconnectToolBarButton);

    /* VIEWS */
    final JToolBar viewToolBar = new JToolBar();
    final JButton refreshButton = new SmallToolbarButton(new RefreshAction());
    toggleFullscreenButton = new SmallToolbarButton(new ToggleFullscreenAction());

    viewToolBar.add(refreshButton);
    viewToolBar.add(toggleFullscreenButton);

    /* ERROR */
    final ErrorPanel errorPanel = new ErrorPanel();
    ExceptionProcessor.getInstance(errorPanel);

    toolbarPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
    addToolBar(fileToolBar);
    addToolBar(digitalToolBar);
    addToolBar(daemonToolBar);
    addToolBar(viewToolBar);

    final JPanel toolbarErrorPanel = new JPanel(new BorderLayout(10, 10));
    toolbarErrorPanel.add(toolbarPanel, BorderLayout.WEST);
    toolbarErrorPanel.add(errorPanel, BorderLayout.EAST);

    add(toolbarErrorPanel, BorderLayout.PAGE_START);
}

From source file:daylightchart.gui.DaylightChartGui.java

private void createFileMenu(final JMenuBar menuBar, final JToolBar toolBar) {

    final GuiAction openLocationsFile = new OpenLocationsFileAction(this);
    final GuiAction saveLocationsFile = new SaveLocationsFileAction(this);
    final GuiAction saveChart = new SaveChartAction(this);
    final GuiAction printChart = new PrintChartAction(locationsTabbedPane);

    final ExitAction exit = new ExitAction(this, Messages.getString("DaylightChartGui.Menu.File.Exit")); //$NON-NLS-1$

    final JMenu menu = new JMenu(Messages.getString("DaylightChartGui.Menu.File")); //$NON-NLS-1$
    menu.setMnemonic('F');

    recentLocationsMenu = new JMenu(Messages.getString("DaylightChartGui.Menu.File.RecentLocations")); //$NON-NLS-1$
    menu.setMnemonic('R');

    menu.add(openLocationsFile);//from  www  .j av  a 2s  .  co  m
    menu.add(saveLocationsFile);
    menu.addSeparator();
    menu.add(saveChart);
    if (!isSlimUi()) {
        menu.add(printChart);
    }
    menu.addSeparator();
    menu.add(recentLocationsMenu);
    menu.addSeparator();
    menu.add(exit);
    menuBar.add(menu);

    toolBar.add(openLocationsFile);
    toolBar.add(saveLocationsFile);
    toolBar.addSeparator();
    toolBar.add(saveChart);
    toolBar.add(printChart);
    toolBar.addSeparator();

}

From source file:apidemo.PanScrollZoomDemo.java

/**
 * Creates the toolbar./*from w ww.j av a  2s. c om*/
 * 
 * @return the toolbar.
 */
private JToolBar createToolbar() {
    final JToolBar toolbar = new JToolBar();

    final ButtonGroup groupedButtons = new ButtonGroup();

    // ACTION_CMD_PAN
    this.panButton = new JToggleButton();
    prepareButton(this.panButton, ACTION_CMD_PAN, " Pan ", "Pan mode");
    groupedButtons.add(this.panButton);
    toolbar.add(this.panButton);

    // ACTION_CMD_ZOOM_BOX
    this.zoomButton = new JToggleButton();
    prepareButton(this.zoomButton, ACTION_CMD_ZOOM_BOX, " Zoom ", "Zoom mode");
    groupedButtons.add(this.zoomButton);
    this.zoomButton.setSelected(true); // no other makes sense after startup
    toolbar.add(this.zoomButton);

    // end of toggle-button group for select/pan/zoom-box
    toolbar.addSeparator();

    // ACTION_CMD_ZOOM_IN
    this.zoomInButton = new JButton();
    prepareButton(this.zoomInButton, ACTION_CMD_ZOOM_IN, " + ", "Zoom in");
    toolbar.add(this.zoomInButton);

    // ACTION_CMD_ZOOM_OUT
    this.zoomOutButton = new JButton();
    prepareButton(this.zoomOutButton, ACTION_CMD_ZOOM_OUT, " - ", "Zoom out");
    toolbar.add(this.zoomOutButton);

    // ACTION_CMD_ZOOM_TO_FIT
    this.fitButton = new JButton();
    prepareButton(this.fitButton, ACTION_CMD_ZOOM_TO_FIT, " Fit ", "Fit all");
    toolbar.add(this.fitButton);

    toolbar.addSeparator();

    this.scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    //   int ht = (int) zoomButton.getPreferredSize().getHeight();
    //   scrollBar.setPreferredSize(new Dimension(0, ht));
    this.scrollBar.setModel(new DefaultBoundedRangeModel());

    toolbar.add(this.scrollBar);

    this.zoomOutButton.setEnabled(false);
    this.fitButton.setEnabled(false);
    this.scrollBar.setEnabled(false);

    toolbar.setFloatable(false);
    return toolbar;
}

From source file:net.sf.jabref.EntryEditor.java

/**
 * Create toolbar for entry editor.//w ww.j av  a  2 s.  c  o m
 */
private void setupToolBar() {
    JToolBar tlb = new JToolBar(JToolBar.VERTICAL);
    CloseAction closeAction = new CloseAction();
    ;
    StoreFieldAction storeFieldAction = new StoreFieldAction();
    DeleteAction deleteAction = new DeleteAction();
    UndoAction undoAction = new UndoAction();
    RedoAction redoAction = new RedoAction();

    tlb.setBorder(null);
    tlb.setRollover(true);
    tlb.setMargin(new Insets(0, 0, 0, 2));
    tlb.setFloatable(false);
    tlb.addSeparator();
    tlb.add(deleteAction);
    tlb.addSeparator();
    tlb.add(prevEntryAction);
    tlb.add(nextEntryAction);
    tlb.addSeparator();
    tlb.add(helpAction);
    for (Component comp : tlb.getComponents()) {
        ((JComponent) comp).setOpaque(false);
    }

    // The toolbar carries all the key bindings that are valid for the whole window.
    ActionMap am = tlb.getActionMap();
    InputMap im = tlb.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    im.put(prefs.getKey("Close entry editor"), "close");
    am.put("close", closeAction);
    im.put(prefs.getKey("Entry editor, store field"), "store");
    am.put("store", storeFieldAction);
    im.put(prefs.getKey("Entry editor, previous entry"), "prev");
    am.put("prev", prevEntryAction);
    im.put(prefs.getKey("Entry editor, next entry"), "next");
    am.put("next", nextEntryAction);
    im.put(prefs.getKey("Undo"), "undo");
    am.put("undo", undoAction);
    im.put(prefs.getKey("Redo"), "redo");
    am.put("redo", redoAction);
    im.put(prefs.getKey("Help"), "help");
    am.put("help", helpAction);

    // Add actions (and thus buttons)
    JButton closeBut = new JButton(closeAction);
    closeBut.setText(null);
    closeBut.setBorder(null);

    // Create type-label
    TypeLabel typeLabel = new TypeLabel(entry.getType().getName());

    JPanel leftPan = new JPanel();
    leftPan.setLayout(new BorderLayout());
    leftPan.add(closeBut, BorderLayout.NORTH);
    leftPan.add(typeLabel, BorderLayout.CENTER);
    leftPan.add(tlb, BorderLayout.SOUTH);

    add(leftPan, BorderLayout.WEST);
}

From source file:daylightchart.gui.DaylightChartGui.java

private void createOptionsMenu(final JMenuBar menuBar, final JToolBar toolBar) {

    final JMenu menu = new JMenu(Messages.getString("DaylightChartGui.Menu.Options")); //$NON-NLS-1$
    menu.setMnemonic('O');

    final GuiAction options = new OptionsAction(this);
    menu.add(options);// w w  w  . j  a  v  a2  s . c o m

    final GuiAction chartOptions = new ChartOptionsAction(this);
    menu.add(chartOptions);

    final GuiAction resetAll = new ResetAllAction(this);
    menu.add(resetAll);

    menu.addSeparator();

    final JCheckBoxMenuItem slimUiMenuItem = new JCheckBoxMenuItem(
            Messages.getString("DaylightChartGui.Menu.Options.SlimUi")); //$NON-NLS-1$
    slimUiMenuItem.setState(isSlimUi());
    slimUiMenuItem.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(final ItemEvent e) {
            final boolean slimUi = e.getStateChange() == ItemEvent.SELECTED;
            final Options options = UserPreferences.optionsFile().getData();
            options.setSlimUi(slimUi);
            UserPreferences.optionsFile().save(options);
            ResetAllAction.restart(DaylightChartGui.this, slimUi);
        }
    });
    menu.add(slimUiMenuItem);

    menuBar.add(menu);

    toolBar.add(options);
    toolBar.add(chartOptions);
    toolBar.addSeparator();
}

From source file:com.nbt.TreeFrame.java

protected JToolBar createToolBar() {
    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);/* w  w w  .j  a v a  2s .  c  o m*/

    Action[] actions = { /* newAction, */browseAction, saveAction, /* saveAsAction, */refreshAction, null,
            deleteAction, null, openAction, null, addByteAction, addShortAction, addIntAction, addLongAction,
            addFloatAction, addDoubleAction, addByteArrayAction, addStringAction, addListAction,
            addCompoundAction };
    for (Action action : actions) {
        if (action == null) {
            toolBar.addSeparator();
        } else {
            ToolBarButton button = new ToolBarButton(action);
            toolBar.add(button);
        }
    }

    return toolBar;
}