Example usage for javax.swing JMenuItem setSelected

List of usage examples for javax.swing JMenuItem setSelected

Introduction

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

Prototype

public void setSelected(boolean b) 

Source Link

Document

Sets the state of the button.

Usage

From source file:LookAndFeelPrefs.java

/**
 * Create a menu of radio buttons listing the available Look and Feels. When
 * the user selects one, change the component hierarchy under frame to the new
 * LAF, and store the new selection as the current preference for the package
 * containing class c.//from   ww  w  .  j  a  v  a 2 s  . c  o m
 */
public static JMenu createLookAndFeelMenu(final Class prefsClass, final ActionListener listener) {
    // Create the menu
    final JMenu plafmenu = new JMenu("Look and Feel");

    // Create an object used for radio button mutual exclusion
    ButtonGroup radiogroup = new ButtonGroup();

    // Look up the available look and feels
    UIManager.LookAndFeelInfo[] plafs = UIManager.getInstalledLookAndFeels();

    // Find out which one is currently used
    String currentLAFName = UIManager.getLookAndFeel().getClass().getName();

    // Loop through the plafs, and add a menu item for each one
    for (int i = 0; i < plafs.length; i++) {
        String plafName = plafs[i].getName();
        final String plafClassName = plafs[i].getClassName();

        // Create the menu item
        final JMenuItem item = plafmenu.add(new JRadioButtonMenuItem(plafName));
        item.setSelected(plafClassName.equals(currentLAFName));

        // Tell the menu item what to do when it is selected
        item.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                // Set the new look and feel
                try {
                    UIManager.setLookAndFeel(plafClassName);
                } catch (UnsupportedLookAndFeelException e) {
                    // Sometimes a Look-and-Feel is installed but not
                    // supported, as in the Windows LaF on Linux platforms.
                    JOptionPane.showMessageDialog(plafmenu,
                            "The selected Look-and-Feel is " + "not supported on this platform.",
                            "Unsupported Look And Feel", JOptionPane.ERROR_MESSAGE);
                    item.setEnabled(false);
                } catch (Exception e) { // ClassNotFound or Instantiation
                    item.setEnabled(false); // shouldn't happen
                }

                // Make the selection persistent by storing it in prefs.
                Preferences p = Preferences.userNodeForPackage(prefsClass);
                p.put(PREF_NAME, plafClassName);

                // Invoke the supplied action listener so the calling
                // application can update its components to the new LAF
                // Reuse the event that was passed here.
                listener.actionPerformed(event);
            }
        });

        // Only allow one menu item to be selected at once
        radiogroup.add(item);
    }

    return plafmenu;
}

From source file:fxts.stations.trader.ui.frames.ChildFrame.java

/**
 * Set state of the corresponding menu item.
 *
 * @param aVisible state of the visibility
 */// w ww  .  j av a2 s.  c o m
public void setMenuItemState(boolean aVisible) {
    //finds menu by name
    JMenu menu = mMainFrame.findMenu("Window");

    //if third menu not initialised
    if (menu == null) {
        return;
    }

    //finds menu item by name
    JMenuItem item = mMainFrame.findMenuItem(getName(), menu);

    //if item not initialised
    if (item == null) {
        return;
    }

    //set item state
    item.setSelected(aVisible);
}

From source file:com.projity.menu.MenuManager.java

public void setActionSelected(String id, boolean enable) {
    Collection buttons = toolBarFactory.getButtonsFromId(id);
    if (buttons != null) {
        Iterator i = buttons.iterator();
        while (i.hasNext()) {
            AbstractButton button = (AbstractButton) i.next();
            if (button != null) {
                button.setSelected(enable);
                if (button instanceof JToggleButton) {
                    //   button.setBackground(enable ? Color.GRAY : ExtButtonFactory.BACKGROUND_COLOR);
                }/*from  w ww .j av  a 2s  .  c om*/
            }
        }
    }
    JMenuItem menuItem = menuFactory.getMenuItemFromId(id);
    if (menuItem != null)
        menuItem.setSelected(enable);
    Iterator i = tabbedNavigations.iterator();
    while (i.hasNext())
        ((TabbedNavigation) i.next()).setActivatedView(id, enable);

}

From source file:au.org.ala.delta.editor.DeltaEditor.java

private void buildWindowMenu(JMenu mnuWindow) {
    mnuWindow.removeAll();//from  ww w.j a v a2 s  . c om

    JMenuItem mnuItCascade = new JMenuItem();
    mnuItCascade.setAction(_actionMap.get("cascadeFrames"));
    mnuWindow.add(mnuItCascade);

    JMenuItem mnuItTile = new JMenuItem();
    mnuItTile.setAction(_actionMap.get("tileFrames"));
    mnuWindow.add(mnuItTile);

    JMenuItem mnuItTileHorz = new JMenuItem();
    mnuItTileHorz.setAction(_actionMap.get("tileFramesHorizontally"));
    mnuWindow.add(mnuItTileHorz);

    JMenuItem mnuItArrangeIcons = new JMenuItem();
    mnuItArrangeIcons.setAction(_actionMap.get("arrangeIcons"));
    mnuWindow.add(mnuItArrangeIcons);

    JMenuItem mnuItCloseAll = new JMenuItem();
    mnuItCloseAll.setAction(_actionMap.get("closeAllFrames"));
    mnuWindow.add(mnuItCloseAll);

    mnuWindow.addSeparator();

    JMenuItem mnuItChooseFont = new JMenuItem();
    mnuItChooseFont.setAction(_actionMap.get("chooseFont"));
    mnuWindow.add(mnuItChooseFont);

    mnuWindow.addSeparator();

    JMenu mnuLF = new JMenu();
    mnuLF.setName("mnuLF");
    mnuLF.setText(_resourceMap.getString("mnuLF.text"));
    mnuWindow.add(mnuLF);

    JMenuItem mnuItMetalLF = new JMenuItem();
    mnuItMetalLF.setAction(_actionMap.get("metalLookAndFeel"));
    mnuLF.add(mnuItMetalLF);

    JMenuItem mnuItWindowsLF = new JMenuItem();
    mnuItWindowsLF.setAction(_actionMap.get("systemLookAndFeel"));
    mnuLF.add(mnuItWindowsLF);

    try {
        // Nimbus L&F was added in update java 6 update 10.
        Class.forName("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel").newInstance();
        JMenuItem mnuItNimbusLF = new JMenuItem();
        mnuItNimbusLF.setAction(_actionMap.get("nimbusLookAndFeel"));
        mnuLF.add(mnuItNimbusLF);
    } catch (Exception e) {
        // The Nimbus L&F is not available, no matter.
    }
    mnuWindow.addSeparator();

    int i = 1;
    for (final JInternalFrame frame : _frames) {
        JMenuItem windowItem = new JCheckBoxMenuItem();
        if (i < 10) {
            windowItem.setText(String.format("%d %s", i, frame.getTitle()));
            windowItem.setMnemonic(KeyEvent.VK_1 + (i - 1));
        } else {
            windowItem.setText(frame.getTitle());
        }
        windowItem.setSelected(frame.isSelected());
        windowItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    frame.setSelected(true);
                } catch (PropertyVetoException e1) {
                }
            }
        });
        mnuWindow.add(windowItem);
        ++i;
    }

}

From source file:org.gumtree.vis.awt.time.TimePlotPanel.java

@Override
protected void displayPopupMenu(int x, int y) {
    LegendTitle legend = getChart().getLegend();
    if (legend != null) {
        boolean isVisable = legend.isVisible();
        RectangleEdge location = legend.getPosition();
        if (isVisable) {
            if (location.equals(RectangleEdge.BOTTOM)) {
                legendBottom.setSelected(true);
                legendNone.setSelected(false);
                legendRight.setSelected(false);
            } else if (isVisable && location.equals(RectangleEdge.RIGHT)) {
                legendRight.setSelected(true);
                legendNone.setSelected(false);
                legendBottom.setSelected(false);
            }/*w w w. ja va 2  s.  c o  m*/
        } else {
            legendNone.setSelected(true);
            legendRight.setSelected(false);
            legendBottom.setSelected(false);
        }
    }
    curveManagementMenu.removeAll();
    curveResetMenu.removeAll();
    if (getXYPlot().getDatasetCount() > 0) {
        curveManagementMenu.setEnabled(true);
        curveResetMenu.setEnabled(true);

        JMenuItem focusNoneCurveItem = new JRadioButtonMenuItem();
        focusNoneCurveItem.setText("None");
        focusNoneCurveItem.setActionCommand(UNFOCUS_CURVE_COMMAND);
        focusNoneCurveItem.addActionListener(this);
        curveManagementMenu.add(focusNoneCurveItem);

        JMenuItem resetAllCurveItem = new JMenuItem();
        resetAllCurveItem.setText("RESET ALL");
        resetAllCurveItem.setActionCommand(RESET_ALL_CURVE_COMMAND);
        resetAllCurveItem.addActionListener(this);
        curveResetMenu.add(resetAllCurveItem);

        boolean isCurveFocused = false;
        for (int j = 0; j < getXYPlot().getDatasetCount(); j++) {
            XYDataset dataset = getChart().getXYPlot().getDataset(j);
            if (dataset != null) {
                for (int i = 0; i < dataset.getSeriesCount(); i++) {
                    String seriesKey = (String) dataset.getSeriesKey(i);
                    JMenuItem focusOnCurveItem = new JRadioButtonMenuItem();
                    focusOnCurveItem.setText(seriesKey);
                    focusOnCurveItem.setActionCommand(FOCUS_ON_COMMAND + "-" + seriesKey);
                    focusOnCurveItem.addActionListener(this);
                    curveManagementMenu.add(focusOnCurveItem);
                    if (dataset == selectedDataset && i == selectedSeriesIndex) {
                        focusOnCurveItem.setSelected(true);
                        isCurveFocused = true;
                    }

                    JMenuItem resetCurveItem = new JMenuItem();
                    resetCurveItem.setText("Reset " + seriesKey);
                    resetCurveItem.setActionCommand(RESET_CURVE_COMMAND + "-" + seriesKey);
                    resetCurveItem.addActionListener(this);
                    curveResetMenu.add(resetCurveItem);

                }
            }
        }
        if (!isCurveFocused) {
            focusNoneCurveItem.setSelected(true);
        }
    } else {
        curveManagementMenu.setEnabled(false);
        curveResetMenu.setEnabled(false);
    }

    showMultiAxesMenuItem.setSelected(isShowMultiaxes());

    if (isPaused) {
        pauseMenuItem.setText("Paused");
    } else {
        pauseMenuItem.setText("Click to Pause");
    }
    pauseMenuItem.setSelected(isPaused);
    super.displayPopupMenu(x, y);
}

From source file:at.becast.youploader.gui.FrmMain.java

public void loadAccounts() {
    int i = 0;//from   w ww .j av a2 s . c om
    HashMap<AccountType, Integer> accounts = accMng.load();
    for (Entry<AccountType, Integer> entry : accounts.entrySet()) {
        getCmbAccount().addItem(entry.getKey());
        AccListModel.addElement(entry.getKey());
        JMenuItem rdoBtn = new JMenuItem(entry.getKey().toString());
        if (entry.getValue() == 1) {
            rdoBtn.setSelected(true);
            getCmbAccount().setSelectedItem(entry.getKey());
        }
        rdoBtn.setActionCommand(entry.getKey().toString());
        rdoBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                editAccount(e.getActionCommand());
            }
        });
        _accounts.put(i, rdoBtn);
        mnuAcc.add(rdoBtn);
        i++;
    }
    if (!accounts.isEmpty()) {
        btnAddToQueue.setEnabled(true);
    }

}

From source file:org.gumtree.vis.plot1d.Plot1DPanel.java

@Override
protected void displayPopupMenu(int x, int y) {
    LegendTitle legend = getChart().getLegend();
    if (legend != null) {
        boolean isVisable = legend.isVisible();
        RectangleEdge location = legend.getPosition();
        if (isVisable) {
            if (location.equals(RectangleEdge.BOTTOM)) {
                legendBottom.setSelected(true);
                legendNone.setSelected(false);
                legendInternal.setSelected(false);
                legendRight.setSelected(false);
            } else if (isVisable && location.equals(RectangleEdge.RIGHT)) {
                legendRight.setSelected(true);
                legendNone.setSelected(false);
                legendInternal.setSelected(false);
                legendBottom.setSelected(false);
            }/*  w w  w .java 2s.com*/
        } else {
            if (isInternalLegendEnabled) {
                legendNone.setSelected(false);
                legendInternal.setSelected(true);
                legendRight.setSelected(false);
                legendBottom.setSelected(false);
            } else {
                legendNone.setSelected(true);
                legendInternal.setSelected(false);
                legendRight.setSelected(false);
                legendBottom.setSelected(false);
            }
        }
    }
    XYDataset dataset = getChart().getXYPlot().getDataset();
    curveManagementMenu.removeAll();
    if (dataset.getSeriesCount() > 0) {
        curveManagementMenu.setEnabled(true);
        JMenuItem focusNoneCurveItem = new JRadioButtonMenuItem();
        focusNoneCurveItem.setText("None");
        focusNoneCurveItem.setActionCommand(UNFOCUS_CURVE_COMMAND);
        focusNoneCurveItem.addActionListener(this);
        curveManagementMenu.add(focusNoneCurveItem);
        boolean isCurveFocused = false;
        for (int i = 0; i < dataset.getSeriesCount(); i++) {
            String seriesKey = (String) dataset.getSeriesKey(i);
            JMenuItem focusOnCurveItem = new JRadioButtonMenuItem();
            focusOnCurveItem.setText(seriesKey);
            focusOnCurveItem.setActionCommand(FOCUS_ON_COMMAND + "-" + seriesKey);
            focusOnCurveItem.addActionListener(this);
            curveManagementMenu.add(focusOnCurveItem);
            if (i == selectedSeriesIndex) {
                focusOnCurveItem.setSelected(true);
                isCurveFocused = true;
            }
        }
        if (!isCurveFocused) {
            focusNoneCurveItem.setSelected(true);
        }
    } else {
        curveManagementMenu.setEnabled(false);
    }
    //        addMaskMenu(x, y);
    super.displayPopupMenu(x, y);
}

From source file:org.gumtree.vis.awt.JChartPanel.java

protected void addMaskMenu(int x, int y) {
    if (this.removeSelectedMaskMenuItem != null) {
        boolean isRemoveMenuEnabled = false;
        if (this.selectedMask != null) {
            Rectangle2D screenMask = ChartMaskingUtilities.getMaskFramework(selectedMask, getScreenDataArea(),
                    getChart());// w ww . java  2s .  c o  m
            if (screenMask.contains(x, y)) {
                isRemoveMenuEnabled = true;
            }
        }
        this.removeSelectedMaskMenuItem.setEnabled(isRemoveMenuEnabled);
        if (isRemoveMenuEnabled) {
            removeSelectedMaskMenuItem.setVisible(true);
            removeSelectedMaskMenuItem.setText("Remove " + selectedMask.getName());
        } else {
            //              removeSelectedMaskMenuItem.setText("Mask Management");
            removeSelectedMaskMenuItem.setVisible(false);
        }
    }
    maskManagementMenu.removeAll();
    if (maskList.size() > 0) {
        maskManagementMenu.setEnabled(true);
        JMenuItem selectNoneMaskItem = new JRadioButtonMenuItem();
        selectNoneMaskItem.setText("Select None");
        selectNoneMaskItem.setActionCommand(DESELECT_MASK_COMMAND);
        selectNoneMaskItem.addActionListener(this);
        maskManagementMenu.add(selectNoneMaskItem);
        boolean isInShade = false;
        for (AbstractMask mask : maskList.keySet()) {
            Rectangle2D screenMask = ChartMaskingUtilities.getMaskFramework(mask, getScreenDataArea(),
                    getChart());
            if (screenMask.contains(x, y)) {
                JMenuItem selectMaskItem = new JRadioButtonMenuItem();
                selectMaskItem.setText("Select " + mask.getName());
                selectMaskItem.setActionCommand(SELECT_MASK_COMMAND + "-" + mask.getName());
                if (mask == selectedMask) {
                    selectMaskItem.setSelected(true);
                }
                selectMaskItem.addActionListener(this);
                maskManagementMenu.add(selectMaskItem);
                isInShade = true;
            }
        }
        if (isInShade) {
            if (selectedMask == null) {
                selectNoneMaskItem.setSelected(true);
            }
        } else {
            for (AbstractMask mask : getMasks()) {
                JMenuItem selectMaskItem = new JRadioButtonMenuItem();
                selectMaskItem.setText("Select " + mask.getName());
                selectMaskItem.setActionCommand(SELECT_MASK_COMMAND + "-" + mask.getName());
                if (mask == selectedMask) {
                    selectMaskItem.setSelected(true);
                }
                selectMaskItem.addActionListener(this);
                maskManagementMenu.add(selectMaskItem);
            }
            selectNoneMaskItem.setSelected(selectedMask == null);
        }
    } else {
        maskManagementMenu.setEnabled(false);
    }
}

From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java

public void fileTableClicked(FileObjectTableModel fileObjectTableModel, JTableX<FileObject> table,
        MouseEvent e) {//from  w ww .  j ava  2s.  c o  m
    int row = table.convertRowIndexToModel(table.rowAtPoint(e.getPoint()));
    //int column = table.convertColumnIndexToModel(table.columnAtPoint(e.getPoint()));
    final Collection<FileObject> selectedFileObjects = table.getSelectedObjects();

    final FileObject f = fileObjectTableModel.getRowObjects().get(row);

    if (SwingUtilities.isRightMouseButton(e)) {
        JPopupMenu m = new JPopupMenu();
        {
            JMenuItem menuitem = new JMenuItem("ffnen");
            menuitem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openFile(f);
                }
            });
            m.add(menuitem);
        }
        {
            JMenuItem menuitem = new JMenuItem("Ordner ffnen");
            menuitem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openFolder(f);
                }
            });
            m.add(menuitem);
        }
        {
            JMenuItem menuitem = new JMenuItem("Herunterladen (ber SOAP)");
            menuitem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    downloadFiles(selectedFileObjects, DownloadMethod.WEBSERVICE);
                }

            });
            m.add(menuitem);
        }
        {
            JMenuItem menuitem = new JMenuItem("Herunterladen (ber WEBDAV)");
            menuitem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    if (!syncService.getIliasSoapService().isWebdavAuthenticationActive()) {
                        syncService.getIliasSoapService().enableWebdavAuthentication(
                                mainFrame.getFieldLogin().getText(),
                                mainFrame.getFieldPassword().getPassword());
                    }
                    downloadFiles(selectedFileObjects, DownloadMethod.WEBDAV);
                }

            });
            m.add(menuitem);
        }
        {
            JMenuItem menuitem = new JMenuItem("In Ilias ffnen");
            menuitem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openInIlias(f);
                }
            });
            m.add(menuitem);
        }
        {
            m.add(new JSeparator());
        }
        {
            JCheckBoxMenuItem menuitem = new JCheckBoxMenuItem("Ignorieren");
            menuitem.setSelected(iliasProperties.getBlockedFiles().contains(f.getRefId()));
            menuitem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    switchIgnoreState(selectedFileObjects);
                }
            });
            m.add(menuitem);
        }
        {
            m.add(new JSeparator());
        }
        {
            JMenuItem menuitem = new JMenuItem("Fehler anzeigen");
            menuitem.setEnabled(f.getException() != null);
            menuitem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    showError("Fehler bei " + f.getTargetFile().getAbsolutePath(), f.getException());
                }

            });
            m.add(menuitem);
        }
        m.show(table, e.getX(), e.getY());
    }

    if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() > 1) {
        openFile(f);
    }
}

From source file:livecanvas.mesheditor.MeshEditor.java

public JMenuBar createMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    JMenu menu, subMenu;/*from   ww  w . jav a  2s  .  com*/
    JMenuItem menuItem;
    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;
}