/** * Define the main About menu. * * @param al the action listener to associate to the menu. * @return the menu. */ public JMenu defineAboutMenu(ActionListener al) { JMenu about = new JMenu(Globals.messages.getString("About")); JMenuItem aboutMenu = new JMenuItem(Globals.messages.getString("About_menu")); about.add(aboutMenu); aboutMenu.addActionListener(al); return about; }
/** * Define the main Circuit menu. * * @param al the action listener to associate to the menu. * @return the menu. */ public JMenu defineCircuitMenu(ActionListener al) { JMenu circuitMenu = new JMenu(Globals.messages.getString("Circuit")); JMenuItem defineCircuit = new JMenuItem(Globals.messages.getString("Define")); defineCircuit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, Globals.shortcutKey)); circuitMenu.add(defineCircuit); JMenuItem updateLibraries = new JMenuItem(Globals.messages.getString("LibraryUpdate")); updateLibraries.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, Globals.shortcutKey)); circuitMenu.add(updateLibraries); defineCircuit.addActionListener(al); updateLibraries.addActionListener(al); return circuitMenu; }
/** * Define the main View menu. * * @param al the action listener to associate to the menu. * @return the menu. */ public JMenu defineViewMenu(ActionListener al) { JMenu viewMenu = new JMenu(Globals.messages.getString("View")); JMenuItem layerOptions = new JMenuItem(Globals.messages.getString("Layer_opt")); layerOptions.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, Globals.shortcutKey)); viewMenu.add(layerOptions); layerOptions.addActionListener(al); return viewMenu; }
/** * Create the main File menu. * * @param al the action listener to associate to the menu. * @return the menu. */ public JMenu defineFileMenu(ActionListener al) { JMenu fileMenu = new JMenu(Globals.messages.getString("File")); JMenuItem fileNew = new JMenuItem(Globals.messages.getString("New")); fileNew.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Globals.shortcutKey)); JMenuItem fileOpen = new JMenuItem(Globals.messages.getString("Open")); fileOpen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Globals.shortcutKey)); JMenuItem fileSave = new JMenuItem(Globals.messages.getString("Save")); fileSave.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Globals.shortcutKey)); JMenuItem fileSaveName = new JMenuItem(Globals.messages.getString("SaveName")); fileSaveName.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_S, Globals.shortcutKey | InputEvent.SHIFT_MASK)); JMenuItem fileSaveNameSplit = new JMenuItem(Globals.messages.getString("Save_split")); JMenuItem fileExport = new JMenuItem(Globals.messages.getString("Export")); fileExport.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, Globals.shortcutKey)); JMenuItem filePrint = new JMenuItem(Globals.messages.getString("Print")); filePrint.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, Globals.shortcutKey)); JMenuItem fileClose = new JMenuItem(Globals.messages.getString("Close")); fileClose.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, Globals.shortcutKey)); JMenuItem options = new JMenuItem(Globals.messages.getString("Circ_opt")); // Add the items in the file menu. fileMenu.add(fileNew); fileMenu.add(fileOpen); fileMenu.add(fileSave); fileMenu.add(fileSaveName); fileMenu.addSeparator(); fileMenu.add(fileSaveNameSplit); fileMenu.addSeparator(); fileMenu.add(fileExport); fileMenu.add(filePrint); fileMenu.addSeparator(); // On a MacOSX system, options is associated to preferences menu // in the application menu. We do not need to show it in File. // This needs the AppleSpecific extensions to be active. if (!Globals.weAreOnAMac) { fileMenu.add(options); fileMenu.addSeparator(); } fileMenu.add(fileClose); // Define all the action listeners fileNew.addActionListener(al); fileOpen.addActionListener(al); fileExport.addActionListener(al); filePrint.addActionListener(al); fileClose.addActionListener(al); fileSave.addActionListener(al); fileSaveName.addActionListener(al); fileSaveNameSplit.addActionListener(al); options.addActionListener(al); return fileMenu; }
/** * Define the Edit main menu. * * @param al the action listener to associate to the menu. * @return the menu. */ public JMenu defineEditMenu(ActionListener al) { JMenu editMenu = new JMenu(Globals.messages.getString("Edit_menu")); JMenuItem editUndo = new JMenuItem(Globals.messages.getString("Undo")); editUndo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Globals.shortcutKey)); // editUndo.setEnabled(false); JMenuItem editRedo = new JMenuItem(Globals.messages.getString("Redo")); editRedo.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_Z, Globals.shortcutKey | InputEvent.SHIFT_MASK)); // editRedo.setEnabled(false); JMenuItem editCut = new JMenuItem(Globals.messages.getString("Cut")); editCut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Globals.shortcutKey)); JMenuItem editCopy = new JMenuItem(Globals.messages.getString("Copy")); editCopy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Globals.shortcutKey)); JMenuItem editCopySplit = new JMenuItem(Globals.messages.getString("Copy_split")); editCopySplit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, Globals.shortcutKey)); JMenuItem editPaste = new JMenuItem(Globals.messages.getString("Paste")); editPaste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Globals.shortcutKey)); JMenuItem clipboardCircuit = new JMenuItem(Globals.messages.getString("DefineClipboard")); JMenuItem editSelectAll = new JMenuItem(Globals.messages.getString("SelectAll")); editSelectAll.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, Globals.shortcutKey)); JMenuItem editDuplicate = new JMenuItem(Globals.messages.getString("Duplicate")); editDuplicate.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, Globals.shortcutKey)); JMenuItem editRotate = new JMenuItem(Globals.messages.getString("Rotate")); editRotate.setAccelerator(KeyStroke.getKeyStroke("R")); JMenuItem editMirror = new JMenuItem(Globals.messages.getString("Mirror_E")); editMirror.setAccelerator(KeyStroke.getKeyStroke("S")); editUndo.addActionListener(al); editRedo.addActionListener(al); editCut.addActionListener(al); editCopy.addActionListener(al); editCopySplit.addActionListener(al); editPaste.addActionListener(al); editSelectAll.addActionListener(al); editDuplicate.addActionListener(al); editMirror.addActionListener(al); editRotate.addActionListener(al); clipboardCircuit.addActionListener(al); editMenu.add(editUndo); editMenu.add(editRedo); editMenu.addSeparator(); editMenu.add(editCut); editMenu.add(editCopy); editMenu.add(editCopySplit); editMenu.add(editPaste); editMenu.add(clipboardCircuit); editMenu.add(editDuplicate); editMenu.addSeparator(); editMenu.add(editSelectAll); editMenu.addSeparator(); editMenu.add(editRotate); editMenu.add(editMirror); return editMenu; }