Example usage for javax.swing JMenu addSeparator

List of usage examples for javax.swing JMenu addSeparator

Introduction

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

Prototype

public void addSeparator() 

Source Link

Document

Appends a new separator to the end of the menu.

Usage

From source file:net.sf.clichart.main.ChartFrame.java

private void createMenu() {
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);/*from   w  w  w.j  a va  2  s . c  o  m*/

    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);

    JMenuItem saveItem = new JMenuItem("Save as...", KeyEvent.VK_S);
    saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
    saveItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            saveChart();
        }
    });
    fileMenu.add(saveItem);

    JMenuItem exitItem = new JMenuItem("Exit", KeyEvent.VK_Q);
    exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
    exitItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    fileMenu.addSeparator();
    fileMenu.add(exitItem);

}

From source file:de.dakror.virtualhub.server.ServerFrame.java

public void init() {
    initFiles();//from www .j  a v  a  2  s.com

    logArea = new JTextArea();
    logArea.setWrapStyleWord(true);
    logArea.setEditable(false);
    logArea.setLineWrap(true);
    DefaultCaret caret = (DefaultCaret) logArea.getCaret();
    caret.setSelectionVisible(false);
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

    wrap = new JScrollPane(logArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    setContentPane(wrap);

    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("Aktionen");
    menu.add(new JMenuItem(
            new AbstractAction("Protokoll leeren", new ImageIcon(getClass().getResource("/img/trash.png"))) {
                private static final long serialVersionUID = 1L;

                @Override
                public void actionPerformed(ActionEvent e) {
                    logArea.setText("");
                    log("Protokoll geleert.");
                }
            }));
    menu.add(logEnabled = new JCheckBoxMenuItem("Protokoll aktiviert",
            new ImageIcon(getClass().getResource("/img/log.png")), true));
    menu.add(packetLogEnabled = new JCheckBoxMenuItem("Paketverkehr protokollieren",
            new ImageIcon(getClass().getResource("/img/traffic.png")), false));
    menu.addSeparator();
    menu.add(new JMenuItem(new AbstractAction("Backup-Einstellungen",
            new ImageIcon(getClass().getResource("/img/backup_edit.png"))) {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                BackupEditDialog.show();
            } catch (JSONException e1) {
                e1.printStackTrace();
            }
        }
    }));

    menuBar.add(menu);
    setJMenuBar(menuBar);
}

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

private JMenu createViewMenu() {
    GraphicOptions view_opt = theCanvas.getWorkspace().getGraphicOptions();

    JMenu view_menu = new JMenu("View");
    view_menu.setMnemonic(KeyEvent.VK_V);

    // zoom //  w  w  w .j a  va2 s .  co  m
    view_menu.add(theActionManager.get("zoomnone"));
    view_menu.add(theActionManager.get("zoomin"));
    view_menu.add(theActionManager.get("zoomout"));

    view_menu.addSeparator();

    // notation 
    JRadioButtonMenuItem last = null;
    ButtonGroup groupn = new ButtonGroup();

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("notation=" + GraphicOptions.NOTATION_CFG)));
    last.setSelected(view_opt.NOTATION.equals(GraphicOptions.NOTATION_CFG));
    groupn.add(last);

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("notation=" + GraphicOptions.NOTATION_CFGBW)));
    last.setSelected(view_opt.NOTATION.equals(GraphicOptions.NOTATION_CFGBW));
    groupn.add(last);

    view_menu.add(last = new JRadioButtonMenuItem(
            theActionManager.get("notation=" + GraphicOptions.NOTATION_CFGLINK)));
    last.setSelected(view_opt.NOTATION.equals(GraphicOptions.NOTATION_CFGLINK));
    groupn.add(last);

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("notation=" + GraphicOptions.NOTATION_UOXF)));
    last.setSelected(view_opt.NOTATION.equals(GraphicOptions.NOTATION_UOXF));
    groupn.add(last);

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("notation=" + GraphicOptions.NOTATION_TEXT)));
    last.setSelected(view_opt.NOTATION.equals(GraphicOptions.NOTATION_TEXT));
    groupn.add(last);

    view_menu.addSeparator();

    // display 

    display_button_group = new ButtonGroup();
    display_models = new HashMap<String, ButtonModel>();

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("display=" + GraphicOptions.DISPLAY_COMPACT)));
    last.setSelected(view_opt.DISPLAY.equals(GraphicOptions.DISPLAY_COMPACT));
    display_models.put(GraphicOptions.DISPLAY_COMPACT, last.getModel());
    display_button_group.add(last);

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("display=" + GraphicOptions.DISPLAY_NORMAL)));
    last.setSelected(view_opt.DISPLAY.equals(GraphicOptions.DISPLAY_NORMAL));
    display_models.put(GraphicOptions.DISPLAY_NORMAL, last.getModel());
    display_button_group.add(last);

    view_menu.add(last = new JRadioButtonMenuItem(
            theActionManager.get("display=" + GraphicOptions.DISPLAY_NORMALINFO)));
    last.setSelected(view_opt.DISPLAY.equals(GraphicOptions.DISPLAY_NORMALINFO));
    display_models.put(GraphicOptions.DISPLAY_NORMALINFO, last.getModel());
    display_button_group.add(last);

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("display=" + GraphicOptions.DISPLAY_CUSTOM)));
    last.setSelected(view_opt.DISPLAY.equals(GraphicOptions.DISPLAY_CUSTOM));
    display_models.put(GraphicOptions.DISPLAY_CUSTOM, last.getModel());
    display_button_group.add(last);

    //view_menu.add( lastcb = new JCheckBoxMenuItem(theActionManager.get("showinfo")) );
    //lastcb.setState(view_opt.SHOW_INFO);

    view_menu.addSeparator();

    // orientation

    view_menu.add(theActionManager.get("orientation"));

    view_menu.addSeparator();

    view_menu.add(theActionManager.get("displaysettings"));
    view_menu.add(theActionManager.get("reportsettings"));

    return view_menu;
}

From source file:edu.ku.brc.specify.BackupAndRestoreApp.java

/**
 * Create menus//w w w  . ja va2 s . c om
 */
public JMenuBar createMenus() {
    JMenuBar mb = new JMenuBar();
    JMenuItem mi;

    //--------------------------------------------------------------------
    //-- File Menu
    //--------------------------------------------------------------------
    JMenu menu = UIHelper.createLocalizedMenu(mb, "Specify.FILE_MENU", "Specify.FILE_MNEU"); //$NON-NLS-1$ //$NON-NLS-2$

    if (UIHelper.getOSType() != UIHelper.OSTYPE.MacOSX) {
        String title = "Specify.EXIT"; //$NON-NLS-1$
        String mnu = "Specify.Exit_MNEU"; //$NON-NLS-1$
        mi = UIHelper.createLocalizedMenuItem(menu, title, mnu, title, true, null);
        mi.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                doExit(true);
            }
        });
    }

    HelpMgr.setAppDefHelpId("Backup_Restore");

    JMenu helpMenu = UIHelper.createLocalizedMenu(mb, "Specify.HELP_MENU", "Specify.HELP_MNEU"); //$NON-NLS-1$ //$NON-NLS-2$
    HelpMgr.createHelpMenuItem(helpMenu, "Backup and Restore"); //$NON-NLS-1$
    helpMenu.addSeparator();

    if (UIHelper.getOSType() != UIHelper.OSTYPE.MacOSX) {
        String ttle = "Specify.ABOUT";//$NON-NLS-1$ 
        String mneu = "Specify.ABOUTMNEU";//$NON-NLS-1$ 
        String desc = "Specify.ABOUT";//$NON-NLS-1$ 
        mi = UIHelper.createLocalizedMenuItem(helpMenu, ttle, mneu, desc, true, null);
        mi.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                doAbout();
            }
        });
    }
    return mb;
}

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

/**
 * Add in the zoom menu items/*  ww  w .  j  a  v  a  2  s. c  o  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);
}

From source file:livecanvas.mesheditor.MeshEditor.java

public JMenuBar createMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    JMenu menu, subMenu;
    JMenuItem menuItem;/*  w  w  w.  j a va  2s .c  om*/
    menu = new JMenu("File");
    menu.setMnemonic(KeyEvent.VK_F);
    menu.add(menuItem = Utils.createMenuItem("New", NEW, KeyEvent.VK_N, "ctrl N", this));
    menu.add(menuItem = Utils.createMenuItem("Open...", OPEN, KeyEvent.VK_O, "ctrl O", this));
    menu.add(menuItem = Utils.createMenuItem("Save", SAVE, KeyEvent.VK_S, "ctrl S", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Exit", EXIT, KeyEvent.VK_X, "", this));
    menuBar.add(menu);
    menu = new JMenu("Edit");
    menu.setMnemonic(KeyEvent.VK_E);
    menu.add(menuItem = Utils.createMenuItem("Undo", UNDO, KeyEvent.VK_U, "ctrl Z", this));
    menu.add(menuItem = Utils.createMenuItem("Redo", REDO, KeyEvent.VK_R, "ctrl Y", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Cut", CUT, KeyEvent.VK_T, "ctrl X", this));
    menu.add(menuItem = Utils.createMenuItem("Copy", COPY, KeyEvent.VK_C, "ctrl C", this));
    menu.add(menuItem = Utils.createMenuItem("Paste", PASTE, KeyEvent.VK_P, "ctrl V", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Select All", SELECT_ALL, KeyEvent.VK_A, "ctrl A", this));
    menu.add(menuItem = Utils.createMenuItem("Invert Selection", INVERT_SELECTION, 0, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Settings...", SETTINGS, KeyEvent.VK_S, "", this));
    menuBar.add(menu);
    menu = new JMenu("Tools");
    menu.setMnemonic(KeyEvent.VK_T);
    menu.add(menuItem = Utils.createMenuItem("Brush", TOOLS_BRUSH, KeyEvent.VK_B, "B", this));
    menu.add(menuItem = Utils.createMenuItem("Pencil", TOOLS_PEN, KeyEvent.VK_N, "N", this));
    menu.add(menuItem = Utils.createMenuItem("Magic Wand", TOOLS_MAGICWAND, KeyEvent.VK_W, "W", this));
    menu.add(menuItem = Utils.createMenuItem("Set Control Points", TOOLS_SETCONTROLPOINTS, KeyEvent.VK_C, "C",
            this));
    menu.add(menuItem = Utils.createMenuItem("Pointer", TOOLS_POINTER, KeyEvent.VK_P, "P", this));
    menu.add(menuItem = Utils.createMenuItem("Pan / Zoom", TOOLS_PANZOOM, KeyEvent.VK_Z, "Z", this));
    menuBar.add(menu);
    menu = new JMenu("Layers");
    menu.setMnemonic(KeyEvent.VK_L);
    menu.add(menuItem = Utils.createMenuItem("Add Layer...", ADD_LAYER, KeyEvent.VK_A, "", this));
    menu.add(menuItem = Utils.createMenuItem("Remove", REMOVE_LAYER, KeyEvent.VK_R, "", this));
    menu.add(menuItem = Utils.createMenuItem("Duplicate", DUPLICATE_LAYER, KeyEvent.VK_C, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Move Up", MOVEUP_LAYER, KeyEvent.VK_U, "", this));
    menu.add(menuItem = Utils.createMenuItem("Move Down", MOVEDOWN_LAYER, KeyEvent.VK_D, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Reparent Layer...", REPARENT_LAYER, KeyEvent.VK_R, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Group Layers", GROUP_LAYERS, KeyEvent.VK_G, "", this));
    menu.add(menuItem = Utils.createMenuItem("Ungroup Layer", UNGROUP_LAYER, KeyEvent.VK_N, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Join Layers", JOIN_LAYERS, KeyEvent.VK_J, "", this));
    menu.add(menuItem = Utils.createMenuItem("Intersect", INTERSECT_LAYERS, KeyEvent.VK_I, "", this));
    menu.add(menuItem = Utils.createMenuItem("Subtract", SUBTRACT_LAYERS, KeyEvent.VK_S, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Rename...", RENAME_LAYER, KeyEvent.VK_E, "", this));
    menu.addSeparator();
    subMenu = new JMenu("Background Reference");
    subMenu.add(menuItem = Utils.createMenuItem("Set...", BGREF_SET, KeyEvent.VK_S, "", this));
    subMenu.add(menuItem = Utils.createMenuItem("Remove", BGREF_REMOVE, KeyEvent.VK_R, "", this));
    menu.add(subMenu);
    menuBar.add(menu);
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Create Mesh Grid", CREATE_MESHGRID, KeyEvent.VK_M, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createCheckBoxMenuItem("See Through", SEE_THROUGH, KeyEvent.VK_T, "", this));
    menuItem.setSelected(true);
    menu.add(menuItem = Utils.createCheckBoxMenuItem("Show Mesh", SHOW_MESH, KeyEvent.VK_M, "", this));
    menuItem.setSelected(true);
    return menuBar;
}

From source file:org.jax.maanova.fit.gui.ResidualPlotPanel.java

@SuppressWarnings("serial")
private JMenuBar createMenu() {
    JMenuBar menuBar = new JMenuBar();

    // the file menu
    JMenu fileMenu = new JMenu("File");
    fileMenu.add(this.saveGraphImageAction);
    menuBar.add(fileMenu);/*from   w  w  w. j  a v a  2 s .c  o  m*/

    // the tools menu
    JMenu toolsMenu = new JMenu("Tools");
    JMenuItem configureGraphItem = new JMenuItem("Configure Graph...");
    configureGraphItem.addActionListener(new ActionListener() {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            ResidualPlotPanel.this.chartConfigurationDialog.setVisible(true);
        }
    });
    toolsMenu.add(configureGraphItem);
    toolsMenu.addSeparator();

    toolsMenu.add(new AbstractAction("Zoom Out") {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            ResidualPlotPanel.this.autoRangeChart();
        }
    });
    toolsMenu.addSeparator();

    JCheckBoxMenuItem showTooltipCheckbox = new JCheckBoxMenuItem("Show Info Popup for Nearest Point");
    showTooltipCheckbox.setSelected(true);
    this.showTooltip = true;
    showTooltipCheckbox.addItemListener(new ItemListener() {
        /**
         * {@inheritDoc}
         */
        public void itemStateChanged(ItemEvent e) {
            ResidualPlotPanel.this.showTooltip = e.getStateChange() == ItemEvent.SELECTED;
            ResidualPlotPanel.this.clearProbePopup();
        }
    });
    toolsMenu.add(showTooltipCheckbox);
    menuBar.add(toolsMenu);

    // the help menu
    JMenu helpMenu = new JMenu("Help");
    JMenuItem helpMenuItem = new JMenuItem("Help...",
            new ImageIcon(ResidualPlotAction.class.getResource("/images/action/help-16x16.png")));
    helpMenuItem.addActionListener(new ActionListener() {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            Maanova.getInstance().showHelp("residual-plot", ResidualPlotPanel.this);
        }
    });
    helpMenu.add(helpMenuItem);
    menuBar.add(helpMenu);

    return menuBar;
}

From source file:org.jax.maanova.madata.gui.ArrayScatterPlotPanel.java

@SuppressWarnings("serial")
private JMenuBar createMenu() {
    JMenuBar menuBar = new JMenuBar();

    // the file menu
    JMenu fileMenu = new JMenu("File");
    fileMenu.add(this.saveGraphImageAction);
    menuBar.add(fileMenu);//from  w w w . j  a  va 2s.  c om

    // the tools menu
    JMenu toolsMenu = new JMenu("Tools");
    JMenuItem configureGraphItem = new JMenuItem("Configure Graph...");
    configureGraphItem.addActionListener(new ActionListener() {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            ArrayScatterPlotPanel.this.chartConfigurationDialog.setVisible(true);
        }
    });
    toolsMenu.add(configureGraphItem);
    toolsMenu.addSeparator();

    toolsMenu.add(new AbstractAction("Zoom Out") {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            ArrayScatterPlotPanel.this.autoRangeChart();
        }
    });

    JCheckBoxMenuItem showTooltipCheckbox = new JCheckBoxMenuItem("Show Info Popup for Nearest Point");
    showTooltipCheckbox.setSelected(true);
    this.showTooltip = true;
    showTooltipCheckbox.addItemListener(new ItemListener() {
        /**
         * {@inheritDoc}
         */
        public void itemStateChanged(ItemEvent e) {
            ArrayScatterPlotPanel.this.showTooltip = e.getStateChange() == ItemEvent.SELECTED;
            ArrayScatterPlotPanel.this.clearProbePopup();
        }
    });
    toolsMenu.add(showTooltipCheckbox);
    menuBar.add(toolsMenu);

    // the help menu
    JMenu helpMenu = new JMenu("Help");
    JMenuItem helpMenuItem = new JMenuItem("Help...");
    Icon helpIcon = new ImageIcon(ArrayScatterPlotPanel.class.getResource("/images/action/help-16x16.png"));
    helpMenuItem.setIcon(helpIcon);
    helpMenuItem.addActionListener(new ActionListener() {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            Maanova.getInstance().showHelp("array-scatter-plot", ArrayScatterPlotPanel.this);
        }
    });
    helpMenu.add(helpMenuItem);
    menuBar.add(helpMenu);

    return menuBar;
}

From source file:be.agiv.security.demo.Main.java

private void addMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);//from  w  ww. ja  v a 2s  .co  m

    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);
    this.preferencesMenuItem = new JMenuItem("Preferences");
    fileMenu.add(this.preferencesMenuItem);
    this.preferencesMenuItem.addActionListener(this);
    fileMenu.addSeparator();
    this.exitMenuItem = new JMenuItem("Exit");
    fileMenu.add(this.exitMenuItem);
    this.exitMenuItem.addActionListener(this);

    JMenu ipStsMenu = new JMenu("IP-STS");
    menuBar.add(ipStsMenu);
    this.ipStsIssueMenuItem = new JMenuItem("Issue token");
    ipStsMenu.add(this.ipStsIssueMenuItem);
    this.ipStsIssueMenuItem.addActionListener(this);
    this.ipStsViewMenuItem = new JMenuItem("View token");
    ipStsMenu.add(this.ipStsViewMenuItem);
    this.ipStsViewMenuItem.addActionListener(this);
    this.ipStsViewMenuItem.setEnabled(false);

    JMenu rStsMenu = new JMenu("R-STS");
    menuBar.add(rStsMenu);
    this.rStsIssueMenuItem = new JMenuItem("Issue token");
    rStsMenu.add(this.rStsIssueMenuItem);
    this.rStsIssueMenuItem.addActionListener(this);
    this.rStsIssueMenuItem.setEnabled(false);
    this.rStsViewMenuItem = new JMenuItem("View token");
    rStsMenu.add(this.rStsViewMenuItem);
    this.rStsViewMenuItem.addActionListener(this);
    this.rStsViewMenuItem.setEnabled(false);

    JMenu secConvMenu = new JMenu("Secure Conversation");
    menuBar.add(secConvMenu);
    this.secConvIssueMenuItem = new JMenuItem("Issue token");
    secConvMenu.add(this.secConvIssueMenuItem);
    this.secConvIssueMenuItem.addActionListener(this);
    this.secConvIssueMenuItem.setEnabled(false);
    this.secConvViewMenuItem = new JMenuItem("View token");
    secConvMenu.add(this.secConvViewMenuItem);
    this.secConvViewMenuItem.addActionListener(this);
    this.secConvViewMenuItem.setEnabled(false);
    this.secConvCancelMenuItem = new JMenuItem("Cancel token");
    secConvMenu.add(this.secConvCancelMenuItem);
    this.secConvCancelMenuItem.addActionListener(this);
    this.secConvCancelMenuItem.setEnabled(false);

    JMenu servicesMenu = new JMenu("Services");
    menuBar.add(servicesMenu);
    this.claimsAwareServiceMenuItem = new JMenuItem("Claims aware service");
    servicesMenu.add(this.claimsAwareServiceMenuItem);
    this.claimsAwareServiceMenuItem.addActionListener(this);

    menuBar.add(Box.createHorizontalGlue());
    JMenu helpMenu = new JMenu("Help");
    menuBar.add(helpMenu);
    this.aboutMenuItem = new JMenuItem("About");
    helpMenu.add(this.aboutMenuItem);
    this.aboutMenuItem.addActionListener(this);
}

From source file:cl.almejo.vsim.gui.SimWindow.java

private void addMenu() {
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = newMenu(Messages.t("menu.file"), KeyEvent.VK_F, menuBar);
    menu.add(newMenuItem(NEW_ACTION, Messages.c("menu.file.new.mnemonic")));
    menu.add(newMenuItem(OPEN_ACTION, Messages.c("menu.file.open.mnemonic")));
    menu.add(newMenuItem(SAVE_ACTION, Messages.c("menu.file.save.mnemonic")));
    menu.add(newMenuItem(SAVE_AS_ACTION, Messages.c("menu.file.saveas.mnemonic")));
    menu.addSeparator();
    menu.add(newMenuItem(QUIT_ACTION, Messages.c("menu.file.quit.mnemonic")));

    menu = newMenu(Messages.t("menu.edit"), KeyEvent.VK_F, menuBar);
    menu.add(newMenuItem(CUT_ACTION, Messages.c("menu.edit.cut.mnemonic")));
    menu.add(newMenuItem(COPY_ACTION, Messages.c("menu.edit.copy.mnemonic")));
    menu.add(newMenuItem(PASTE_ACTION, Messages.c("menu.edit.paste.mnemonic")));
    menu.add(newMenuItem(UNDO_ACTION, Messages.c("menu.edit.undo.mnemonic")));
    menu.add(newMenuItem(REDO_ACTION, Messages.c("menu.edit.redo.mnemonic")));
    menu.add(newMenuItem(PREFERENCES_ACTION, Messages.c("menu.edit.preferences.mnemonic")));

    menu = newMenu(Messages.t("menu.view"), KeyEvent.VK_V, menuBar);
    menu.add(newCheckboxMenuItem(SHOW_GRID_ACTION, Messages.c("menu.view.grid.mnemonic"), true));

    menu = newMenu(Messages.t("menu.tools"), KeyEvent.VK_H, menuBar);
    menu.add(newMenuItem(CURSOR_TOOL_ACTION, Messages.c("menu.tool.cursor.mnemonic")));
    menu.add(newMenuItem(MOVE_VIEWPORT_TOOL_ACTION, Messages.c("menu.tool.move.viewport.mnemonic")));
    menu.add(newMenuItem(WIRES_TOOL_ACTION, Messages.c("menu.tool.wires.mnemonic")));
    menu.add(newMenuItem(AND2_TOOL_ACTION, Messages.c("menu.tool.and2.mnemonic")));
    menu.add(newMenuItem(AND3_TOOL_ACTION, Messages.c("menu.tool.and3.mnemonic")));
    menu.add(newMenuItem(AND4_TOOL_ACTION, Messages.c("menu.tool.and4.mnemonic")));

    menu.add(newMenuItem(OR2_TOOL_ACTION, Messages.c("menu.tool.or2.mnemonic")));
    menu.add(newMenuItem(OR3_TOOL_ACTION, Messages.c("menu.tool.or3.mnemonic")));
    menu.add(newMenuItem(OR4_TOOL_ACTION, Messages.c("menu.tool.or4.mnemonic")));

    menu.add(newMenuItem(XOR2_TOOL_ACTION, Messages.c("menu.tool.or2.mnemonic")));
    menu.add(newMenuItem(XOR3_TOOL_ACTION, Messages.c("menu.tool.or3.mnemonic")));
    menu.add(newMenuItem(XOR4_TOOL_ACTION, Messages.c("menu.tool.or4.mnemonic")));

    menu.add(newMenuItem(CLOCK_TOOL_ACTION, Messages.c("menu.tool.clock.mnemonic")));
    menu.add(newMenuItem(NOT_TOOL_ACTION, Messages.c("menu.tool.not.mnemonic")));
    menu.add(newMenuItem(FLIP_FLOP_DATA_TOOL_ACTION, Messages.c("menu.tool.flip.flop.data.mnemonic")));
    menu.add(newMenuItem(TRISTATE_TOOL_ACTION, Messages.c("menu.tool.tristate.mnemonic")));
    menu.add(newMenuItem(SEVEN_SEGMENTS_DISPLAY_TOOL_ACTION,
            Messages.c("menu.tool.seven.segments.display.mnemonic")));
    menu.add(newMenuItem(SEVEN_SEGMENTS_DISPLAY_DOUBLE_TOOL_ACTION,
            Messages.c("menu.tool.seven.segments.display.double.mnemonic")));
    menu.add(newMenuItem(LED_TOOL_ACTION, Messages.c("menu.tool.led.mnemonic")));
    menu.add(newMenuItem(TIME_DIAGRAM_TOOL_ACTION, Messages.c("menu.tool.time.diagram.mnemonic")));
    menu.add(newMenuItem(SWITCH_TOOL_ACTION, Messages.c("menu.tool.switch.mnemonic")));

    menu = newMenu(Messages.t("menu.simulation"), KeyEvent.VK_F, menuBar);
    menu.add(newMenuItem(START_ACTION, Messages.c("menu.simulation.start.mnemonic")));
    menu.add(newMenuItem(PAUSE_ACTION, Messages.c("menu.simulation.pause.mnemonic")));

    menu = newMenu(Messages.t("menu.window"), KeyEvent.VK_F, menuBar);
    menu.add(newMenuItem(CLONE_WINDOW_ACTION, Messages.c("menu.window.clone.mnemonic")));
    menu.add(newMenuItem(CLOSE_ACTION, Messages.c("menu.window.close.mnemonic")));

    menu = newMenu(Messages.t("menu.help"), KeyEvent.VK_F, menuBar);
    menu.add(newMenuItem(ONLINE_HELP_ACTION, Messages.c("menu.help.online.mnemonic")));
    menu.add(newMenuItem(ABOUT_ACTION, Messages.c("menu.help.about.mnemonic")));

    setJMenuBar(menuBar);// w  w w  .  j a  v a2s  .  c om
}