/** * Make the edit menu * * @param editMenu edit menu * @return edit menu */ public JMenu makeEditMenu(JMenu editMenu) { editMenu.add(GuiUtils.makeDynamicMenu("Symbols", this, "initSymbolsMenu")); editMenu.add( GuiUtils.makeMenuItem("Set properties on selected", this, "setPropertiesOnSelected")); editMenu.addSeparator(); return super.makeEditMenu(editMenu); }
/** * Make the view menu * * @param viewMenu view menu * @return The view menu */ public JMenu makeViewMenu(JMenu viewMenu) { showAlignmentPointsMI = new JCheckBoxMenuItem("Show Alignment Points", true); viewMenu.add(showAlignmentPointsMI); showAlignmentPointsMI.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { repaint(); } }); viewMenu.addSeparator(); super.makeViewMenu(viewMenu); viewMenu.addSeparator(); viewMenu.add(makeMenuItem("Black background", CMD_BLACKBG)); viewMenu.add(makeMenuItem("White background", CMD_WHITEBG)); return viewMenu; }
/** Make the file menu */ private void makeFileMenu() { fileMenu.removeAll(); fileMenu.add(makeMenuItem("New", 'n', GuiUtils.CMD_NEW)); fileMenu.addSeparator(); fileMenu.add(makeMenuItem("Save", 's', GuiUtils.CMD_SAVE)); fileMenu.add(makeMenuItem("Save As...", GuiUtils.CMD_SAVEAS)); fileMenu.add(makeMenuItem("Rename...", GuiUtils.CMD_RENAME)); fileMenu.addSeparator(); JMenuItem removeMenuItem = makeMenuItem("Remove", GuiUtils.CMD_REMOVE); removeMenuItem.setEnabled(smm.isUsers(stationModel)); fileMenu.add(removeMenuItem); fileMenu.addSeparator(); fileMenu.add(makeMenuItem("Import...", GuiUtils.CMD_IMPORT)); fileMenu.add(makeMenuItem("Export...", GuiUtils.CMD_EXPORT)); fileMenu.addSeparator(); fileMenu.add(makeMenuItem("Close", GuiUtils.CMD_CLOSE)); }
public SPanel(JFrame sframe) { balls = new Ball[B_WIDTH][B_HEIGHT]; setBackground(Color.black); JMenuBar mb = new JMenuBar(); sframe.setJMenuBar(mb); JMenu smenu = new JMenu("File"); mb.add(smenu); smenu.setMnemonic('F'); newgame = smenu.add("New Game"); newgame.setMnemonic('N'); smenu.addSeparator(); quitgame = smenu.add("Quit Game"); quitgame.setMnemonic('Q'); ButtonHandler b = new ButtonHandler(); quitgame.addActionListener(b); newgame.addActionListener(b); resetBoard(); addMouseListener(new MouseHandler()); addMouseMotionListener(new MouseMotionHandler()); }