List of usage examples for javax.swing JMenu add
public JMenuItem add(Action a)
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();//from w w w.j a v a 2 s .co m 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); }
From source file:com.net2plan.gui.GUINet2Plan.java
private void start() { setExtendedState(JFrame.MAXIMIZED_BOTH); setMinimumSize(new Dimension(800, 600)); itemObject = new DualHashBidiMap<JMenuItem, Object>(); URL iconURL = GUINet2Plan.class.getResource("/resources/gui/icon.png"); ImageIcon icon = new ImageIcon(iconURL); setIconImage(icon.getImage());/*from w ww. j av a 2 s.co m*/ setTitle("Net2Plan"); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(CLOSE_NET2PLAN); getContentPane().setLayout(new MigLayout("insets 0 0 0 0", "[grow]", "[grow]")); container = new JPanel(new MigLayout("", "[]", "[]")); container.setBorder(new LineBorder(Color.BLACK)); container.setLayout(new MigLayout("fill")); getContentPane().add(container, "grow"); /* Create menu bar */ menu = new JMenuBar(); setJMenuBar(menu); /* File menu */ JMenu file = new JMenu("File"); file.setMnemonic('F'); menu.add(file); optionsItem = new JMenuItem("Options"); optionsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.ALT_DOWN_MASK)); optionsItem.addActionListener(this); file.add(optionsItem); classPathEditorItem = new JMenuItem("Classpath editor"); classPathEditorItem.addActionListener(this); file.add(classPathEditorItem); errorConsoleItem = new JMenuItem("Show Java console"); errorConsoleItem.addActionListener(this); errorConsoleItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, InputEvent.ALT_DOWN_MASK)); file.add(errorConsoleItem); exitItem = new JMenuItem("Exit"); exitItem.addActionListener(this); exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_DOWN_MASK)); file.add(exitItem); /* Help menu */ JMenu help = new JMenu("Help"); help.setMnemonic('H'); menu.add(help); aboutItem = new JMenuItem("About"); aboutItem.addActionListener(this); help.add(aboutItem); itemObject.put(aboutItem, showAbout()); helpItem = new JMenuItem("User's guide"); helpItem.addActionListener(this); helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, KeyEvent.VK_UNDEFINED)); help.add(helpItem); javadocItem = new JMenuItem("Library API Javadoc"); javadocItem.addActionListener(this); help.add(javadocItem); javadocExamplesItem = new JMenuItem("Built-in Examples Javadoc"); javadocExamplesItem.addActionListener(this); help.add(javadocExamplesItem); keyCombinationItem = new JMenuItem("Show tool key combinations"); keyCombinationItem.addActionListener(this); keyCombinationItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, KeyEvent.ALT_DOWN_MASK)); help.add(keyCombinationItem); usedKeyStrokes = new LinkedHashSet<KeyStroke>(); refreshMenu(); container.add(showAbout(), "align center"); container.revalidate(); new JFileChooser(); /* Do not remove! It is used to avoid slow JFileChooser first-time loading once Net2Plan is shown to the user */ setVisible(true); }
From source file:jchrest.gui.Shell.java
private JMenu createModelMenu(int time) { JMenu menu = new JMenu("Model"); menu.setMnemonic(KeyEvent.VK_M); menu.add(new ClearModelAction(this)); menu.getItem(0).setMnemonic(KeyEvent.VK_C); JMenu submenu = new JMenu("Save"); submenu.setMnemonic(KeyEvent.VK_S); submenu.add(new SaveModelAsVnaAction(this, time)); submenu.getItem(0).setMnemonic(KeyEvent.VK_N); submenu.add(new SaveModelSemanticLinksAsVnaAction(this, time)); submenu.getItem(1).setMnemonic(KeyEvent.VK_L); menu.add(submenu);/* w ww. j a v a 2s.co m*/ menu.add(new ModelPropertiesAction(this)); menu.getItem(2).setMnemonic(KeyEvent.VK_P); menu.add(new JSeparator()); menu.add(new ModelInformationAction(this, time)); menu.getItem(4).setMnemonic(KeyEvent.VK_I); menu.add(new ViewModelAction(this)); menu.getItem(5).setMnemonic(KeyEvent.VK_V); return menu; }
From source file:ffx.ui.MainMenu.java
private JMenu addSubMenu(JMenu parent, String name, char mnemonic) { JMenu menu = new JMenu(locale.getValue(name)); parent.add(menu); if (mnemonic != '.') { menu.setMnemonic(mnemonic);//from w w w .j a v a 2 s .c o m } menu.setIcon(blankIcon); return menu; }
From source file:Main.java
protected JMenuBar createMenuBar() { final JMenuBar menuBar = new JMenuBar(); JMenu mFont = new JMenu("Font"); mFont.setMnemonic('o'); ButtonGroup group = new ButtonGroup(); fontMenus = new JMenuItem[FontName.length]; for (int k = 0; k < FontName.length; k++) { int m = k + 1; fontMenus[k] = new JRadioButtonMenuItem(m + " " + FontName[k]); boolean selected = (k == 0); fontMenus[k].setSelected(selected); fontMenus[k].setMnemonic('1' + k); fontMenus[k].setFont(fonts[k]);//w w w .ja v a2s.co m fontMenus[k].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.out.println(((JComponent) arg0.getSource()).getFont()); } }); group.add(fontMenus[k]); mFont.add(fontMenus[k]); } menuBar.add(mFont); return menuBar; }
From source file:unikn.dbis.univis.visualization.graph.plaf.VGraphUI.java
/** * Creates the listener responsible for calling the correct handlers based * on mouse events, and to select invidual cells. *//*from w w w . j a v a 2 s . co m*/ protected MouseListener createMouseListener() { return new MouseHandler() { /** * Invoked when a mouse button has been pressed on a component. * //@Override public void mousePressed(MouseEvent e) { Object o = graph.getFirstCellForLocation(e.getX(), e.getY()); if (o instanceof VGraphCell) { VGraphCell cell = (VGraphCell) o; JPopupMenu menu = new JPopupMenu(); VChartPanel chartPanel = (VChartPanel) cell.getUserObject(); if (chartPanel.isShowPopUp()) { LegendItemCollection collect = chartPanel.getChart().getPlot().getLegendItems(); JMenu first = new JMenu("1-39"); int checker = 0; for (Iterator iter = collect.iterator(); iter.hasNext();) { LegendItem item = (LegendItem) iter.next(); checker++; first.add(new JMenuItem(item.getLabel())); if ((checker % 40) == 0) { menu.add(first); first = new JMenu("" + checker + "-" + (checker + 39)); } if (!iter.hasNext()) { menu.add(first); } } menu.show(graph, e.getX(), e.getY()); } } super.mousePressed(e); } */ /** * Invoked when a mouse button has been pressed on a component. */ @Override public void mousePressed(MouseEvent e) { Object o = graph.getFirstCellForLocation(e.getX(), e.getY()); if (SwingUtilities.isLeftMouseButton(e) && e.isAltDown()) { if (o instanceof VGraphCell) { VGraphCell cell = (VGraphCell) o; JPopupMenu menu = new JPopupMenu(); VChartPanel chartPanel = (VChartPanel) cell.getUserObject(); LegendItemCollection collect = chartPanel.getChart().getPlot().getLegendItems(); JMenu first = new JMenu("1-39"); int checker = 0; for (Iterator iter = collect.iterator(); iter.hasNext();) { LegendItem item = (LegendItem) iter.next(); checker++; first.add(new JMenuItem(item.getLabel())); if ((checker % 40) == 0) { menu.add(first); first = new JMenu("" + checker + "-" + (checker + 39)); } if (!iter.hasNext()) { menu.add(first); } } menu.show(graph, e.getX(), e.getY()); } } super.mousePressed(e); if (o != null && o instanceof VGraphCell) { VGraphCell cell = (VGraphCell) o; o = cell.getUserObject(); if (o != null && o instanceof VChartPanel) { VChartPanel chart = (VChartPanel) o; for (MouseListener l : chart.getMouseListeners()) { l.mousePressed(e); } } } } // Event may be null when called to cancel the current operation. @Override public void mouseReleased(MouseEvent e) { super.mouseReleased(e); Object o = graph.getFirstCellForLocation(e.getX(), e.getY()); if (o != null && o instanceof VGraphCell) { VGraphCell cell = (VGraphCell) o; o = cell.getUserObject(); if (o != null && o instanceof VChartPanel) { VChartPanel chart = (VChartPanel) o; for (MouseListener l : chart.getMouseListeners()) { l.mouseReleased(e); } } } } /** * Invoked when the mouse has been clicked on a component. */ @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); Object o = graph.getFirstCellForLocation(e.getX(), e.getY()); if (o != null && o instanceof VGraphCell) { VGraphCell cell = (VGraphCell) o; o = cell.getUserObject(); if (o != null && o instanceof VChartPanel) { VChartPanel chart = (VChartPanel) o; if (SwingUtilities.isRightMouseButton(e)) { JPopupMenu menu = chart.createPopupMenu(true, true, true, true); menu.show(graph, e.getX(), e.getY()); } /* for (MouseListener l : chart.getMouseListeners()) { System.out.println("LISTENS CLI"); l.mouseClicked(e); } */ } } } /* // Event may be null when called to cancel the current operation. @Override public void mouseReleased(MouseEvent e) { super.mouseReleased(e); Object[] cells = graphSelectionModel.getSelectionCells(); Rectangle2D bounds = graph.getCellBounds(cells); if (bounds != null) { Rectangle2D b2 = graph.toScreen((Rectangle2D) bounds.clone()); graph.scrollRectToVisible(new Rectangle((int) b2.getX(), (int) b2.getY(), (int) b2.getWidth(), (int) b2.getHeight())); } } */ /** * Invoked when the mouse pointer has been moved on a component (with no * buttons down). */ @Override public void mouseMoved(MouseEvent e) { if (graph.isMoveable()) { super.mouseMoved(e); } Object o = graph.getFirstCellForLocation(e.getX(), e.getY()); if (o != null && o instanceof VGraphCell) { selectedCell = (VGraphCell) o; Rectangle2D bounds = graph.getCellBounds(selectedCell); menu.show(graph, (int) (bounds.getX() + bounds.getWidth()), (int) bounds.getY() + (int) (bounds.getHeight() - menu.getHeight())); } } }; }
From source file:com.raceup.fsae.test.TesterGui.java
/** * Creates new edit menu/*from w w w .j a v a 2s. c o m*/ * * @return edit menu */ private JMenu createEditMenu() { JMenu menu = new JMenu("Edit"); // file menu JMenuItem item = new JMenuItem("Test submissions seconds wait"); item.addActionListener(e -> { String userInput = JOptionPane.showInputDialog("Test submissions seconds wait", SECONDS_WAIT_BETWEEN_SUBMISSIONS); SECONDS_WAIT_BETWEEN_SUBMISSIONS = Integer.parseInt(userInput); // update }); menu.add(item); return menu; }
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 //from w ww . jav a 2s . 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:net.chaosserver.timelord.swingui.TimelordMenu.java
/** * Creates the view menu./*from www . j a v a2 s . c om*/ * * @return the new view menu */ protected JMenu createViewMenu() { JMenuItem menuItem; JMenu viewMenu = new JMenu("View"); viewMenu.setMnemonic(KeyEvent.VK_V); JMenu annoyanceModeMenu = new JMenu("Annoyance Mode"); annoyanceJordanCheckbox = new JCheckBoxMenuItem("Jordan Mode"); annoyanceJordanCheckbox.setToolTipText("For Cool People"); annoyanceJordanCheckbox.setActionCommand(ACTION_ANNOY_JORDAN); annoyanceJordanCheckbox.addActionListener(this); annoyanceModeMenu.add(annoyanceJordanCheckbox); annoyanceDougCheckbox = new JCheckBoxMenuItem("Doug Mode"); annoyanceDougCheckbox.setToolTipText("For Losers"); annoyanceJordanCheckbox.setActionCommand(ACTION_ANNOY_DOUG); annoyanceDougCheckbox.addActionListener(this); annoyanceModeMenu.add(annoyanceDougCheckbox); annoyanceNoneCheckbox = new JCheckBoxMenuItem("None"); annoyanceJordanCheckbox.setActionCommand(ACTION_ANNOY_NONE); annoyanceNoneCheckbox.addActionListener(this); annoyanceModeMenu.add(annoyanceNoneCheckbox); updateAnnoyanceButtons(); viewMenu.add(annoyanceModeMenu); menuItem = new JMenuItem("Refresh View", KeyEvent.VK_R); menuItem.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); menuItem.setActionCommand(ACTION_REFRESH_VIEW); menuItem.addActionListener(this); viewMenu.add(menuItem); viewMenu.addSeparator(); menuItem = new JMenuItem("Change Start Time"); menuItem.setActionCommand(ACTION_CHANGE_START); menuItem.addActionListener(this); viewMenu.add(menuItem); menuItem = new JMenuItem("Change Annoy Time"); // currently disabled experimental functionality menuItem.setEnabled(false); menuItem.setActionCommand(ACTION_CHANGE_ANNOY); menuItem.addActionListener(this); viewMenu.add(menuItem); viewMenu.addSeparator(); menuItem = new JMenuItem("Select Previous Tab", KeyEvent.VK_BRACELEFT); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BRACELEFT, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); menuItem.setActionCommand(ACTION_PREVIOUS_TAB); menuItem.addActionListener(this); viewMenu.add(menuItem); menuItem = new JMenuItem("Select Next Tab", KeyEvent.VK_BRACERIGHT); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BRACERIGHT, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); menuItem.setActionCommand(ACTION_NEXT_TAB); menuItem.addActionListener(this); viewMenu.add(menuItem); return viewMenu; }
From source file:org.sbml.bargraph.MainWindow.java
/** * Set up menus when running under Windows. *///from www. j a v a2 s.c o m public void registerForEvents() { Log.note("Setting up the Windows menus."); JMenuItem fileExitItem = new JMenuItem(); fileExitItem .setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, shortcutKeyMask)); fileExitItem.setMnemonic(java.awt.event.KeyEvent.VK_C); fileExitItem.setText("Exit"); fileExitItem.setToolTipText("Exit application"); fileExitItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { quit(); } }); fileMenu.addSeparator(); fileMenu.add(fileExitItem); JMenu helpMenu = new JMenu(); helpMenu.setText("Help"); JMenuItem aboutMenuItem = new JMenuItem(); aboutMenuItem.setText("About " + Config.APP_NAME); aboutMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { about(); } }); helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); }