Example usage for javax.swing JMenu JMenu

List of usage examples for javax.swing JMenu JMenu

Introduction

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

Prototype

public JMenu(Action a) 

Source Link

Document

Constructs a menu whose properties are taken from the Action supplied.

Usage

From source file:de.freese.base.swing.mac_os_x.MyApp.java

/**
 *
 *//*  w  w  w  .j  a  v a  2s .  c  o  m*/
public void addMenus() {
    JMenu fileMenu = new JMenu("File");
    JMenuBar mainMenuBar = new JMenuBar();
    mainMenuBar.add(fileMenu = new JMenu("File"));
    fileMenu.add(this.openMI = new JMenuItem("Open..."));
    this.openMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, MENU_MASK));
    this.openMI.addActionListener(this);

    // Quit/prefs menu items are provided on Mac OS X; only add your own on other platforms
    if (!IS_OS_MAC_OSX) {
        fileMenu.addSeparator();
        fileMenu.add(this.optionsMI = new JMenuItem("Options"));
        this.optionsMI.addActionListener(this);

        fileMenu.addSeparator();
        fileMenu.add(this.quitMI = new JMenuItem("Quit"));
        this.quitMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, MENU_MASK));
        this.quitMI.addActionListener(this);
    }

    mainMenuBar.add(this.helpMenu = new JMenu("Help"));
    this.helpMenu.add(this.docsMI = new JMenuItem("Online Documentation"));
    this.helpMenu.addSeparator();
    this.helpMenu.add(this.supportMI = new JMenuItem("Technical Support"));

    // About menu item is provided on Mac OS X; only add your own on other platforms
    if (!IS_OS_MAC_OSX) {
        this.helpMenu.addSeparator();
        this.helpMenu.add(this.aboutMI = new JMenuItem("About OSXAdapter"));
        this.aboutMI.addActionListener(this);
    }

    setJMenuBar(mainMenuBar);
}

From source file:com.limegroup.gnutella.gui.library.LibraryTableMediator.java

private JMenu createSearchSubMenu(LibraryTableDataLine dl) {
    JMenu menu = new JMenu(GUIMediator.getStringResource("LIBRARY_TABLE_SEARCH_POPUP_MENU"));

    if (dl != null) {
        File f = (File) dl.getInitializeObject();
        String keywords = StringUtils.createQueryString(f.getName());
        if (keywords.length() > 2)
            menu.add(new JMenuItem(new SearchAction(keywords)));

        LimeXMLDocument doc = dl.getXMLDocument();
        if (doc != null) {
            Action[] actions = ActionUtils.createSearchActions(doc);
            for (int i = 0; i < actions.length; i++)
                menu.add(new JMenuItem(actions[i]));
        }/* w  ww .  j  ava2  s . c  o m*/
    }

    if (menu.getItemCount() == 0)
        menu.setEnabled(false);

    return menu;
}

From source file:TextComponentDemo.java

protected JMenu createEditMenu() {
    JMenu menu = new JMenu("Edit");

    //Undo and redo are actions of our own creation.
    undoAction = new UndoAction();
    menu.add(undoAction);/*from w  w  w.  j a  v  a  2  s  .co  m*/

    redoAction = new RedoAction();
    menu.add(redoAction);

    menu.addSeparator();

    //These actions come from the default editor kit.
    //Get the ones we want and stick them in the menu.
    menu.add(getActionByName(DefaultEditorKit.cutAction));
    menu.add(getActionByName(DefaultEditorKit.copyAction));
    menu.add(getActionByName(DefaultEditorKit.pasteAction));

    menu.addSeparator();

    menu.add(getActionByName(DefaultEditorKit.selectAllAction));
    return menu;
}

From source file:org.cds06.speleograph.graph.SeriesMenu.java

private JPopupMenu createPopupMenuForSeries(final Series series) {

    if (series == null)
        return new JPopupMenu();

    final JPopupMenu menu = new JPopupMenu(series.getName());

    menu.removeAll();/*www .j  a  va2  s .  c  om*/

    menu.add(new AbstractAction() {
        {
            putValue(NAME, "Renommer la srie");
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            menu.setVisible(false);
            String newName = "";
            while (newName == null || newName.equals("")) {
                newName = (String) JOptionPane.showInputDialog(application,
                        "Entrez un nouveau nom pour la srie", null, JOptionPane.QUESTION_MESSAGE, null, null,
                        series.getName());
            }
            series.setName(newName);
        }
    });

    if (series.hasOwnAxis()) {
        menu.add(new AbstractAction() {

            {
                putValue(NAME, "Supprimer l'axe spcifique");
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                if (JOptionPane.showConfirmDialog(application, "tes vous sr de vouloir supprimer cet axe ?",
                        "Confirmation", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
                    series.setAxis(null);
                }
            }
        });
    } else {
        menu.add(new JMenuItem(new AbstractAction() {

            {
                putValue(NAME, "Crer un axe spcifique pour la srie");
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                String name = JOptionPane.showInputDialog(application, "Quel titre pour cet axe ?",
                        series.getAxis().getLabel());
                if (name == null || "".equals(name))
                    return; // User has canceled
                series.setAxis(new NumberAxis(name));
            }
        }));
    }

    menu.add(new SetTypeMenu(series));

    if (series.isWater()) {
        menu.addSeparator();
        menu.add(new SumOnPeriodAction(series));
        menu.add(new CreateCumulAction(series));
    }
    if (series.isWaterCumul()) {
        menu.addSeparator();
        menu.add(new SamplingAction(series));
    }

    if (series.isPressure()) {
        menu.addSeparator();
        menu.add(new CorrelateAction(series));
        menu.add(new WaterHeightAction(series));
    }

    menu.addSeparator();

    menu.add(new AbstractAction() {
        {
            String name;
            if (series.canUndo())
                name = "Annuler " + series.getItemsName();
            else
                name = series.getLastUndoName();

            putValue(NAME, name);

            if (series.canUndo())
                setEnabled(true);
            else {
                setEnabled(false);
            }

        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.undo();
        }
    });

    menu.add(new AbstractAction() {
        {
            String name;
            if (series.canRedo()) {
                name = "Refaire " + series.getNextRedoName();
                setEnabled(true);
            } else {
                name = series.getNextRedoName();
                setEnabled(false);
            }

            putValue(NAME, name);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.redo();
        }
    });

    menu.add(new AbstractAction() {
        {
            putValue(NAME, I18nSupport.translate("menus.serie.resetSerie"));
            if (series.canUndo())
                setEnabled(true);
            else
                setEnabled(false);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.reset();
        }
    });

    menu.add(new LimitDateRangeAction(series));

    menu.add(new HourSettingAction(series));

    menu.addSeparator();

    {
        JMenuItem deleteItem = new JMenuItem("Supprimer la srie");
        deleteItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (JOptionPane.showConfirmDialog(application,
                        "tes-vous sur de vouloir supprimer cette srie ?\n"
                                + "Cette action est dfinitive.",
                        "Confirmation", JOptionPane.OK_CANCEL_OPTION,
                        JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
                    series.delete();
                }
            }
        });
        menu.add(deleteItem);
    }

    menu.addSeparator();

    {
        final JMenuItem up = new JMenuItem("Remonter dans la liste"),
                down = new JMenuItem("Descendre dans la liste");
        ActionListener listener = new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (e.getSource().equals(up)) {
                    series.upSeriesInList();
                } else {
                    series.downSeriesInList();
                }
            }
        };
        up.addActionListener(listener);
        down.addActionListener(listener);
        if (series.isFirst()) {
            menu.add(down);
        } else if (series.isLast()) {
            menu.add(up);
        } else {
            menu.add(up);
            menu.add(down);
        }
    }

    menu.addSeparator();

    {
        menu.add(new SeriesInfoAction(series));
    }

    {
        JMenuItem colorItem = new JMenuItem("Couleur de la srie");
        colorItem.addActionListener(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                series.setColor(JColorChooser.showDialog(application,
                        I18nSupport.translate("actions.selectColorForSeries"), series.getColor()));
            }
        });
        menu.add(colorItem);
    }

    {
        JMenu plotRenderer = new JMenu("Affichage de la srie");
        final ButtonGroup modes = new ButtonGroup();
        java.util.List<DrawStyle> availableStyles;
        if (series.isMinMax()) {
            availableStyles = DrawStyles.getDrawableStylesForHighLow();
        } else {
            availableStyles = DrawStyles.getDrawableStyles();
        }
        for (final DrawStyle s : availableStyles) {
            final JRadioButtonMenuItem item = new JRadioButtonMenuItem(DrawStyles.getHumanCheckboxText(s));
            item.addChangeListener(new ChangeListener() {
                @Override
                public void stateChanged(ChangeEvent e) {
                    if (item.isSelected())
                        series.setStyle(s);
                }
            });
            modes.add(item);
            if (s.equals(series.getStyle())) {
                modes.setSelected(item.getModel(), true);
            }
            plotRenderer.add(item);
        }
        menu.add(plotRenderer);
    }
    menu.addSeparator();

    menu.add(new AbstractAction() {
        {
            putValue(Action.NAME, "Fermer le fichier");
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            if (JOptionPane.showConfirmDialog(application,
                    "tes-vous sur de vouloir fermer toutes les sries du fichier ?", "Confirmation",
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
                final File f = series.getOrigin();
                for (final Series s : Series.getInstances().toArray(new Series[Series.getInstances().size()])) {
                    if (s.getOrigin().equals(f))
                        s.delete();
                }
            }
        }
    });

    return menu;
}

From source file:com.haskins.cloudtrailviewer.sidebar.EventsChart.java

private JMenu getSessionIssuerMenu(ButtonGroup buttonGroup) {

    JRadioButtonMenuItem mnuSiType = new JRadioButtonMenuItem("Type");
    JRadioButtonMenuItem mnuSiArn = new JRadioButtonMenuItem("Arn");
    JRadioButtonMenuItem mnuSiPrincipalId = new JRadioButtonMenuItem("Principal Id");
    JRadioButtonMenuItem mnuSiAccountId = new JRadioButtonMenuItem("Account Id");
    JRadioButtonMenuItem mnuSiUsername = new JRadioButtonMenuItem("Username");

    mnuSiType.setActionCommand("UserIdentity.SessionContext.SessionIssuer.Type");
    mnuSiType.addActionListener(this);

    mnuSiPrincipalId.setActionCommand("UserIdentity.SessionContext.SessionIssuer.PrincipalId");
    mnuSiPrincipalId.addActionListener(this);

    mnuSiArn.setActionCommand("UserIdentity.SessionContext.SessionIssuer.Arn");
    mnuSiArn.addActionListener(this);

    mnuSiAccountId.setActionCommand("UserIdentity.SessionContext.SessionIssuer.AccountId");
    mnuSiAccountId.addActionListener(this);

    mnuSiUsername.setActionCommand("UserIdentity.SessionContext.SessionIssuer.UserName");
    mnuSiUsername.addActionListener(this);

    buttonGroup.add(mnuSiType);//from  w  w  w. j  a  v  a 2  s .  c  o  m
    buttonGroup.add(mnuSiPrincipalId);
    buttonGroup.add(mnuSiArn);
    buttonGroup.add(mnuSiAccountId);
    buttonGroup.add(mnuSiUsername);

    JMenu siMenu = new JMenu("Session Issuer");
    siMenu.add(mnuSiType);
    siMenu.add(mnuSiPrincipalId);
    siMenu.add(mnuSiArn);
    siMenu.add(mnuSiAccountId);
    siMenu.add(mnuSiUsername);

    return siMenu;
}

From source file:com.googlecode.bpmn_simulator.gui.BPMNSimulatorFrame.java

private JMenu createMenuFile() {
    final JMenu menuFile = new JMenu(Messages.getString("Menu.file")); //$NON-NLS-1$

    final JMenuItem menuFileOpen = new JMenuItem(Messages.getString("Menu.fileOpen")); //$NON-NLS-1$
    menuFileOpen.setMnemonic(KeyEvent.VK_O);
    menuFileOpen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.ALT_MASK));
    menuFileOpen.addActionListener(new ActionListener() {
        @Override//from  ww  w.ja va2 s .c o m
        public void actionPerformed(final ActionEvent e) {
            openFile();
        }
    });
    menuFile.add(menuFileOpen);
    menuFile.add(menuFileRecent);

    final JMenuItem menuFileReload = new JMenuItem(Messages.getString("Menu.fileReload")); //$NON-NLS-1$
    menuFileReload.setMnemonic(KeyEvent.VK_R);
    menuFileReload.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_MASK));
    menuFileReload.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            reloadDefinition();
        }
    });
    menuFile.add(menuFileReload);

    final JMenuItem menuFileClose = new JMenuItem(Messages.getString("Menu.fileClose")); //$NON-NLS-1$
    menuFileClose.setMnemonic(KeyEvent.VK_C);
    menuFileClose.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.ALT_MASK));
    menuFileClose.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            closeSource();
        }
    });
    menuFile.add(menuFileClose);

    menuFile.addSeparator();

    final JMenuItem menuFileProperties = new JMenuItem(Messages.getString("Menu.properties")); //$NON-NLS-1$
    menuFileProperties.setMnemonic(KeyEvent.VK_P);
    menuFileProperties.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.ALT_MASK));
    menuFileProperties.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            showPropertiesDialog();
        }
    });
    menuFile.add(menuFileProperties);

    menuFile.addSeparator();

    final JMenuItem menuFileExport = createMenuFileExport();
    menuFile.add(menuFileExport);

    menuFile.addSeparator();

    final JMenuItem menuFilePreferences = new JMenuItem(Messages.getString("Menu.preferences")); //$NON-NLS-1$
    menuFilePreferences.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            showPreferencesDialog();
        }
    });
    menuFile.add(menuFilePreferences);

    menuFile.addSeparator();

    final JMenuItem menuFileExit = new JMenuItem(Messages.getString("Menu.exit")); //$NON-NLS-1$
    menuFileExit.setMnemonic(KeyEvent.VK_E);
    menuFileExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK));
    menuFileExit.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            for (Frame frame : getFrames()) {
                if (frame.isActive()) {
                    frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
                }
            }
        }
    });
    menuFile.add(menuFileExit);

    menuFile.addMenuListener(new MenuListener() {
        @Override
        public void menuSelected(final MenuEvent e) {
            menuFileReload.setEnabled(isSourceOpen() && currentSource.canReopen());
            menuFileClose.setEnabled(isSourceOpen());
            menuFileProperties.setEnabled(isDefinitionOpen());
            menuFileExport.setEnabled(isDefinitionOpen());
        }

        @Override
        public void menuDeselected(final MenuEvent e) {
        }

        @Override
        public void menuCanceled(final MenuEvent e) {
        }
    });

    return menuFile;
}

From source file:gdt.jgui.entity.JEntityStructurePanel.java

/**
 * Get the context menu.// w w w  .ja  va  2  s  .  co m
 * @return the context menu.
 */
@Override
public JMenu getContextMenu() {
    JMenu menu = new JMenu("Context");
    menu.setName("Context");
    JMenuItem facetItem = new JMenuItem("Facets");
    facetItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Properties locator = Locator.toProperties(locator$);
            String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
            String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
            JEntityFacetPanel efp = new JEntityFacetPanel();
            String efpLocator$ = efp.getLocator();
            efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$);
            efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, entityKey$);
            JConsoleHandler.execute(console, efpLocator$);
        }
    });
    menu.add(facetItem);

    JMenuItem digestItem = new JMenuItem("Digest");
    digestItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Properties locator = Locator.toProperties(locator$);
            String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
            String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
            JEntityDigestDisplay edp = new JEntityDigestDisplay();
            String edpLocator$ = edp.getLocator();
            edpLocator$ = Locator.append(edpLocator$, Entigrator.ENTIHOME, entihome$);
            edpLocator$ = Locator.append(edpLocator$, EntityHandler.ENTITY_KEY, entityKey$);
            JConsoleHandler.execute(console, edpLocator$);
        }
    });
    menu.add(digestItem);
    return menu;
}

From source file:org.nebulaframework.ui.swing.cluster.ClusterMainUI.java

/**
 * Setups the Menu Bar/*from w w  w  .  ja v  a  2s .  c  om*/
 * @return
 */
private JMenuBar setupMenu() {
    JMenuBar menuBar = new JMenuBar();

    /* -- Cluster Menu -- */
    JMenu clusterMenu = new JMenu("Cluster");
    clusterMenu.setMnemonic(KeyEvent.VK_C);
    menuBar.add(clusterMenu);

    // Discover Submenu
    JMenu clusterDiscoverMenu = new JMenu("Disover Peers");
    clusterDiscoverMenu.setMnemonic(KeyEvent.VK_D);
    clusterMenu.add(clusterDiscoverMenu);

    // Discover -> Multicast
    JMenuItem clusterDiscoverMulticast = new JMenuItem("Multicast");
    clusterDiscoverMulticast.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0));
    clusterDiscoverMulticast.setEnabled(false);
    clusterDiscoverMulticast.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doDiscoverMulticast();
        }
    });
    clusterDiscoverMenu.add(clusterDiscoverMulticast);
    addUIElement("menu.cluster.discover.multicast", clusterDiscoverMulticast); // Add to components map

    // Discover -> WS
    JMenuItem clusterDiscoverWS = new JMenuItem("Colombus Web Service");
    clusterDiscoverWS.setEnabled(false);
    clusterDiscoverWS.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0));
    clusterDiscoverWS.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doDiscoverWS();
        }
    });
    clusterDiscoverMenu.add(clusterDiscoverWS);
    addUIElement("menu.cluster.discover.ws", clusterDiscoverWS); // Add to components map

    clusterMenu.addSeparator();

    // Cluster-> Shutdown
    JMenuItem clusterShutdownItem = new JMenuItem("Shutdown", 'u');
    clusterShutdownItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0));
    clusterShutdownItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doShutdownCluster();
        }
    });
    clusterMenu.add(clusterShutdownItem);
    addUIElement("menu.cluster.shutdown", clusterShutdownItem); // Add to components map

    /* -- Options Menu -- */
    JMenu optionsMenu = new JMenu("Options");
    optionsMenu.setMnemonic(KeyEvent.VK_O);
    menuBar.add(optionsMenu);

    // Configuration
    JMenuItem optionsConfigItem = new JMenuItem("Configuration...", 'C');
    optionsConfigItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            showConfiguration();
        }
    });
    optionsMenu.add(optionsConfigItem);
    optionsConfigItem.setEnabled(false); // TODO Create Configuration Options

    /* -- Help Menu -- */
    JMenu helpMenu = new JMenu("Help");
    helpMenu.setMnemonic(KeyEvent.VK_H);
    menuBar.add(helpMenu);

    // Help Contents
    JMenuItem helpContentsItem = new JMenuItem("Help Contents", 'H');
    helpContentsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
    helpContentsItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            showHelp();
        }
    });
    helpMenu.add(helpContentsItem);

    helpMenu.addSeparator();

    JMenuItem helpAboutItem = new JMenuItem("About", 'A');
    helpAboutItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            showAbout();
        }
    });
    helpMenu.add(helpAboutItem);

    return menuBar;
}

From source file:com.AandR.beans.plotting.LinePlotPanel.LinePlotPanel.java

private JMenu createLinePropMenu() {
    JMenuItem symMenu = new JMenuItem("Show/Hide Symbols");
    symMenu.setActionCommand(ACTION_SHOW_SYMBOLS);
    symMenu.addActionListener(plotPanelListener);

    JMenuItem lineMenu = new JMenuItem("Show/Hide Lines");
    lineMenu.setActionCommand(ACTION_HIDE_LINES);
    lineMenu.addActionListener(plotPanelListener);

    JMenu menu = new JMenu("Line Properties");
    menu.add(symMenu);//from  w  w w .  j a  v a  2 s  . c om
    menu.add(lineMenu);
    return menu;
}

From source file:ucar.unidata.idv.control.chart.ChartHolder.java

/**
 * Add in the zoom menu items/*www .jav  a 2  s.  co  m*/
 *
 * @param items items
 */
private void addZoomMenuItems(List items) {
    JMenuItem mi;
    JMenu menu;

    items.add(menu = new JMenu("Zoom In"));
    menu.add(mi = new JMenuItem("All Axes"));
    mi.setActionCommand(ChartPanel.ZOOM_IN_BOTH_COMMAND);
    mi.addActionListener(chartPanel);
    menu.addSeparator();

    menu.add(mi = new JMenuItem("Domain Axis"));
    mi.setActionCommand(ChartPanel.ZOOM_IN_DOMAIN_COMMAND);
    mi.addActionListener(chartPanel);

    menu.add(mi = new JMenuItem("Range Axis"));
    mi.setActionCommand(ChartPanel.ZOOM_IN_RANGE_COMMAND);
    mi.addActionListener(chartPanel);

    items.add(menu = new JMenu("Zoom Out"));

    menu.add(mi = new JMenuItem("All Axes"));
    mi.setActionCommand(ChartPanel.ZOOM_OUT_BOTH_COMMAND);
    mi.addActionListener(chartPanel);

    menu.addSeparator();

    menu.add(mi = new JMenuItem("Domain Axis"));
    mi.setActionCommand(ChartPanel.ZOOM_OUT_DOMAIN_COMMAND);
    mi.addActionListener(chartPanel);

    menu.add(mi = new JMenuItem("Range Axis"));
    mi.setActionCommand(ChartPanel.ZOOM_OUT_RANGE_COMMAND);
    mi.addActionListener(chartPanel);

    items.add(menu = new JMenu("Auto Range"));

    menu.add(mi = new JMenuItem("All Axes"));
    mi.setActionCommand(ChartPanel.ZOOM_RESET_BOTH_COMMAND);
    mi.addActionListener(chartPanel);

    menu.addSeparator();

    menu.add(mi = new JMenuItem("Domain Axis"));
    mi.setActionCommand(ChartPanel.ZOOM_RESET_DOMAIN_COMMAND);
    mi.addActionListener(chartPanel);

    menu.add(mi = new JMenuItem("Range Axis"));
    mi.setActionCommand(ChartPanel.ZOOM_RESET_RANGE_COMMAND);
    mi.addActionListener(chartPanel);
}