Example usage for javax.swing JToolBar add

List of usage examples for javax.swing JToolBar add

Introduction

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

Prototype

public JButton add(Action a) 

Source Link

Document

Adds a new JButton which dispatches the action.

Usage

From source file:dk.dma.epd.common.prototype.gui.notification.ChatServicePanel.java

/**
 * Constructor// w w  w .ja  va 2  s  .c  om
 * 
 * @param compactLayout
 *            if false, there will be message type selectors in the panel
 */
public ChatServicePanel(boolean compactLayout) {
    super(new BorderLayout());

    // Prepare the title header
    titleHeader.setBackground(getBackground().darker());
    titleHeader.setOpaque(true);
    titleHeader.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    titleHeader.setHorizontalAlignment(SwingConstants.CENTER);
    add(titleHeader, BorderLayout.NORTH);

    // Add messages panel
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    messagesPanel.setBackground(UIManager.getColor("List.background"));
    messagesPanel.setOpaque(false);
    messagesPanel.setLayout(new GridBagLayout());
    messagesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(scrollPane, BorderLayout.CENTER);

    JPanel sendPanel = new JPanel(new GridBagLayout());
    add(sendPanel, BorderLayout.SOUTH);
    Insets insets = new Insets(2, 2, 2, 2);

    // Add text area
    if (compactLayout) {
        messageText = new JTextField();
        ((JTextField) messageText).addActionListener(this);
        sendPanel.add(messageText, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0));

    } else {
        messageText = new JTextArea();
        JScrollPane scrollPane2 = new JScrollPane(messageText);
        scrollPane2.setPreferredSize(new Dimension(100, 50));
        scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
        sendPanel.add(scrollPane2, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0, NORTH, BOTH, insets, 0, 0));
    }

    // Add buttons
    ButtonGroup group = new ButtonGroup();
    messageTypeBtn = createMessageTypeButton("Send messages", ICON_MESSAGE, true, group);
    warningTypeBtn = createMessageTypeButton("Send warnings", ICON_WARNING, false, group);
    alertTypeBtn = createMessageTypeButton("Send alerts", ICON_ALERT, false, group);

    if (!compactLayout) {
        JToolBar msgTypePanel = new JToolBar();
        msgTypePanel.setBorderPainted(false);
        msgTypePanel.setOpaque(true);
        msgTypePanel.setFloatable(false);
        sendPanel.add(msgTypePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0));
        msgTypePanel.add(messageTypeBtn);
        msgTypePanel.add(warningTypeBtn);
        msgTypePanel.add(alertTypeBtn);
    }

    if (compactLayout) {
        sendBtn = new JButton("Send");
        sendPanel.add(sendBtn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0));
    } else {
        sendBtn = new JButton("Send", ICON_MESSAGE);
        sendBtn.setPreferredSize(new Dimension(100, sendBtn.getPreferredSize().height));
        sendPanel.add(sendBtn, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0));
    }
    sendBtn.setEnabled(false);
    messageText.setEditable(false);
    sendBtn.addActionListener(this);
}

From source file:jmemorize.gui.swing.frames.MainFrame.java

private JPanel buildOperationsBar() {
    final JToolBar operationsToolbar = new JToolBar();
    operationsToolbar.setFloatable(false);

    operationsToolbar.add(new JButton(new NewLessonAction()));
    operationsToolbar.add(new JButton(new OpenLessonAction(jMemorizeIO, this)));
    operationsToolbar.add(new JButton(new SaveLessonAction(jMemorizeIO)));

    operationsToolbar.add(new JButton(new AddCardAction(this)));
    operationsToolbar.add(new JButton(new EditCardAction(this)));
    operationsToolbar.add(new JButton(new ResetCardAction(this)));
    operationsToolbar.add(new JButton(new RemoveAction(this)));

    operationsToolbar.add(new JButton(new AddCategoryAction(this)));
    operationsToolbar.add(new JButton(new FindAction(this)));
    operationsToolbar.add(new JButton(new LearnAction(this)));

    final JPanel operationsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 1, 1));
    operationsPanel.add(operationsToolbar);

    return operationsPanel;
}

From source file:net.pms.newgui.LooksFrame.java

public JComponent buildContent() {
    JPanel panel = new JPanel(new BorderLayout());
    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);// w  w  w  . ja va 2 s.c  o  m
    toolBar.setRollover(true);

    toolBar.add(new JPanel());

    if (PMS.getConfiguration().useWebInterface()) {
        webinterface = createToolBarButton(Messages.getString("LooksFrame.29"), "button-wif.png");
        webinterface.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                String error = null;
                if (PMS.get().getWebInterface() != null && isNotBlank(PMS.get().getWebInterface().getUrl())) {
                    try {
                        URI uri = new URI(PMS.get().getWebInterface().getUrl());
                        try {
                            Desktop.getDesktop().browse(uri);
                        } catch (RuntimeException | IOException be) {
                            LOGGER.error("Cound not open the default web browser: {}", be.getMessage());
                            LOGGER.trace("", be);
                            error = Messages.getString("LooksFrame.BrowserError") + "\n" + be.getMessage();
                        }
                    } catch (URISyntaxException se) {
                        LOGGER.error("Could not form a valid web interface URI from \"{}\": {}",
                                PMS.get().getWebInterface().getUrl(), se.getMessage());
                        LOGGER.trace("", se);
                        error = Messages.getString("LooksFrame.URIError");
                    }
                } else {
                    error = Messages.getString("LooksFrame.URIError");
                }
                if (error != null) {
                    JOptionPane.showMessageDialog(null, error, Messages.getString("Dialog.Error"),
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        });
        webinterface.setToolTipText(Messages.getString("LooksFrame.30"));
        webinterface.setEnabled(configuration.useWebInterface());
        toolBar.add(webinterface);
        toolBar.addSeparator(new Dimension(20, 1));
    }

    restartIcon = (AnimatedIcon) reload.getIcon();
    restartRequredIcon.start();
    setReloadable(false);
    reload.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            reload.setEnabled(false);
            PMS.get().reset();
        }
    });
    reload.setToolTipText(Messages.getString("LooksFrame.28"));
    toolBar.add(reload);

    toolBar.addSeparator(new Dimension(20, 1));
    AbstractButton quit = createToolBarButton(Messages.getString("LooksFrame.5"), "button-quit.png");
    quit.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            quit();
        }
    });
    toolBar.add(quit);
    if (System.getProperty(START_SERVICE) != null) {
        quit.setEnabled(false);
    }
    toolBar.add(new JPanel());

    // Apply the orientation to the toolbar and all components in it
    ComponentOrientation orientation = ComponentOrientation.getOrientation(PMS.getLocale());
    toolBar.applyComponentOrientation(orientation);
    toolBar.setBorder(new EmptyBorder(new Insets(8, 0, 0, 0)));

    panel.add(toolBar, BorderLayout.NORTH);
    panel.add(buildMain(), BorderLayout.CENTER);
    status = new JLabel("");
    status.setBorder(BorderFactory.createEmptyBorder());
    status.setComponentOrientation(orientation);

    // Calling applyComponentOrientation() here would be ideal.
    // Alas it horribly mutilates the layout of several tabs.
    //panel.applyComponentOrientation(orientation);
    panel.add(status, BorderLayout.SOUTH);

    return panel;
}

From source file:net.sf.nmedit.nomad.core.Nomad.java

private JToolBar createQuickActionToolbar() {
    JToolBar toolbar = new JToolBar();
    toolbar.setBorderPainted(false);/*  w w w. j av  a 2 s .  c  o  m*/
    toolbar.setFloatable(false);
    toolbar.add(Factory.createToolBarButton(menuLayout.getEntry(MENU_FILE_OPEN)));
    toolbar.addSeparator();
    toolbar.add(Factory.createToolBarButton(menuLayout.getEntry(MENU_FILE_SAVE)));
    toolbar.addSeparator();

    JPopupMenu pop = new JPopupMenu();
    Iterator<FileService> iter = ServiceRegistry.getServices(FileService.class);

    JRadioButtonMenuItem rfirst = null;
    SelectedAction sa = new SelectedAction();

    sa.putValue(AbstractAction.SMALL_ICON, getImage("/icons/tango/16x16/actions/document-new.png"));

    while (iter.hasNext()) {
        FileService fs = iter.next();
        if (fs.isNewFileOperationSupported()) {
            JRadioButtonMenuItem rb = new JRadioButtonMenuItem(
                    new AHAction(fs.getName(), fs.getIcon(), fs, "newFile"));
            sa.add(rb);
            pop.add(rb);
            if (rfirst == null)
                rfirst = rb;
        }
    }

    JButton btn = Factory.createToolBarButton(sa);
    toolbar.add(btn);

    new JDropDownButtonControl(btn, pop);
    return toolbar;
}

From source file:com.rapidminer.gui.graphs.GraphViewer.java

private JComponent createControlPanel() {
    // === mouse behaviour ===
    if (graphMouse != null) {
        vv.setGraphMouse(graphMouse);//from  w ww.  j ava2  s. c  o m
        vv.addKeyListener(graphMouse.getModeKeyListener());
        graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);
    }
    transformAction.setEnabled(false);
    pickingAction.setEnabled(true);

    vv.addGraphMouseListener(new GraphMouseListener<V>() {

        @Override
        public void graphClicked(V vertex, MouseEvent arg1) {
        }

        @Override
        public void graphPressed(V arg0, MouseEvent arg1) {
        }

        @Override
        public void graphReleased(V vertex, MouseEvent arg1) {
            if (currentMode.equals(ModalGraphMouse.Mode.TRANSFORMING)) {
                if (graphCreator.getObjectViewer() != null) {
                    vv.getPickedVertexState().clear();
                    vv.getPickedVertexState().pick(vertex, true);
                    graphCreator.getObjectViewer().showObject(graphCreator.getObject(vertex));
                }
            }
        }
    });

    JPanel controls = new JPanel();
    GridBagLayout gbLayout = new GridBagLayout();
    controls.setLayout(gbLayout);
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.insets = new Insets(4, 4, 4, 4);
    c.weightx = 1;
    c.weighty = 0;

    // zooming
    JToolBar zoomBar = new ExtendedJToolBar();
    zoomBar.setLayout(new FlowLayout(FlowLayout.CENTER));
    zoomBar.add(new ZoomInAction(this, IconSize.SMALL));
    zoomBar.add(new ZoomOutAction(this, IconSize.SMALL));
    zoomBar.setBorder(BorderFactory.createTitledBorder("Zoom"));
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(zoomBar, c);
    controls.add(zoomBar);

    // mode
    JToolBar modeBar = new ExtendedJToolBar();
    modeBar.setLayout(new FlowLayout(FlowLayout.CENTER));
    modeBar.add(transformAction);
    modeBar.add(pickingAction);
    modeBar.setBorder(BorderFactory.createTitledBorder("Mode"));
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(modeBar, c);
    controls.add(modeBar);

    // layout selection
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(layoutSelection, c);
    controls.add(layoutSelection);

    // show node labels
    JCheckBox nodeLabels = new JCheckBox("Node Labels", graphCreator.showVertexLabelsDefault());
    nodeLabels.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            togglePaintVertexLabels();
        }
    });
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(nodeLabels, c);
    controls.add(nodeLabels);

    // show edge labels
    JCheckBox edgeLabels = new JCheckBox("Edge Labels", graphCreator.showEdgeLabelsDefault());
    edgeLabels.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            togglePaintEdgeLabels();
        }
    });
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(edgeLabels, c);
    controls.add(edgeLabels);

    // option components
    for (int i = 0; i < graphCreator.getNumberOfOptionComponents(); i++) {
        JComponent optionComponent = graphCreator.getOptionComponent(this, i);
        if (optionComponent != null) {
            c.gridwidth = GridBagConstraints.REMAINDER;
            gbLayout.setConstraints(optionComponent, c);
            controls.add(optionComponent);
        }
    }

    // save image
    JButton imageButton = new JButton("Save Image...");
    imageButton.setToolTipText("Saves an image of the current graph.");
    imageButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final Component tosave = vv;
            new ExportImageAction(false) {

                private static final long serialVersionUID = 1L;

                @Override
                protected PrintableComponent getPrintableComponent() {
                    return new SimplePrintableComponent(tosave, "Graph");
                }

            }.actionPerformed(e);
        }
    });
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(imageButton, c);
    controls.add(imageButton);

    // help
    JButton help = new JButton("Help");
    help.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(vv, INSTRUCTIONS);
        }
    });
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(help, c);
    controls.add(help);

    JPanel fillPanel = new JPanel();
    c.weighty = 1.0d;
    c.gridwidth = GridBagConstraints.REMAINDER;
    gbLayout.setConstraints(fillPanel, c);
    controls.add(fillPanel);

    return controls;
}

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 a v 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:jmemorize.gui.swing.frames.MainFrame.java

private JPanel buildCategoryBar() {
    final JToolBar categoryToolbar = new JToolBar();
    categoryToolbar.setFloatable(false);
    categoryToolbar.setMargin(new Insets(2, 2, 2, 2));

    m_showTreeButton = new JButton(new ShowCategoryTreeAction());
    m_showTreeButton.setPreferredSize(new Dimension(120, 21));
    categoryToolbar.add(m_showTreeButton);

    final JLabel categoryLabel = new JLabel(Localization.get(LC.CATEGORY), SwingConstants.CENTER);
    categoryLabel.setPreferredSize(new Dimension(60, 15));
    categoryToolbar.add(categoryLabel);//from  w  w w.  j av a 2s .  c  om

    m_categoryBox = new CategoryComboBox();
    m_categoryBox.setPreferredSize(new Dimension(24, 24));
    m_categoryBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent evt) {
            categoryBoxActionPerformed();
        }
    });
    categoryToolbar.add(m_categoryBox);
    categoryToolbar.add(new JButton(new SplitMainFrameAction(this)));

    final JPanel categoryPanel = new JPanel(new BorderLayout());
    categoryPanel.setBorder(new EtchedBorder());
    categoryPanel.add(categoryToolbar, BorderLayout.NORTH);

    return categoryPanel;
}

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

private JToolBar createToolBar() {
    JToolBar toolbar = new JToolBar();
    toolbar.setFloatable(false);/*  www  .j  a va 2s  .c  om*/

    toolbar.add(theActionManager.get("new"));
    toolbar.add(theActionManager.get("open"));

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

    toolbar.addSeparator();

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

    return toolbar;
}

From source file:com.intuit.tank.tools.script.ScriptFilterRunner.java

/**
 * @return//from   w  w  w.jav  a2  s .  co  m
 */
private Component createContentPanel() {
    JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
    scriptEditorTA = new RSyntaxTextArea();
    setSyntaxStyle();
    RTextScrollPane sp = new RTextScrollPane(scriptEditorTA);
    pane.setTopComponent(sp);

    JScrollPane scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    JPanel panel = new JPanel(new BorderLayout());
    output = new TextAreaOutputLogger(scrollPane, INITIAL_OUTPUT_CONTENT);
    output.setEditable(false);
    output.setAutoscrolls(true);
    output.setScrollContent(true);
    output.setWrapStyleWord(true);
    scrollPane.setViewportView(output);

    JToolBar toolBar = new JToolBar();
    JButton clearBT = new JButton("Clear");
    clearBT.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            output.setText(INITIAL_OUTPUT_CONTENT);
        }
    });

    final JCheckBox scrollCB = new JCheckBox("Auto Scroll Content");
    scrollCB.setSelected(true);
    scrollCB.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            output.setScrollContent(scrollCB.isSelected());
        }
    });
    toolBar.add(clearBT);
    toolBar.add(scrollCB);

    panel.add(toolBar, BorderLayout.NORTH);
    panel.add(scrollPane, BorderLayout.CENTER);

    pane.setBottomComponent(panel);
    pane.setDividerLocation(300);
    return pane;
}

From source file:apidemo.PanScrollZoomDemo.java

/**
 * Creates the toolbar.//from   w  ww  .  ja  va  2 s  .c  o  m
 * 
 * @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;
}