List of usage examples for javax.swing JMenu addSeparator
public void addSeparator()
From source file:edu.ku.brc.specify.toycode.UpdatesApp.java
public JMenuBar createMenus() { JMenuBar menuBar = null;/*from w ww. j a v a 2s.c om*/ /*UIHelper.createMenuItemWithAction(fileMenu, "Open", "O", "", true, new AbstractAction() //$NON-NLS-1$ { public void actionPerformed(ActionEvent e) { doOpen(); } }); JMenuItem saveMenuItem = UIHelper.createMenuItemWithAction(fileMenu, "Save", "S", "", true, new AbstractAction() //$NON-NLS-1$ { public void actionPerformed(ActionEvent e) { doSave(); } }); saveMenuItem.setEnabled(false); */ if (!UIHelper.isMacOS()) { menuBar = new JMenuBar(); JMenu fileMenu = createMenu(menuBar, "File", "F"); fileMenu.addSeparator(); UIHelper.createMenuItemWithAction(fileMenu, "Exit", "x", "", true, new AbstractAction() //$NON-NLS-1$ { public void actionPerformed(ActionEvent e) { shutdown(); } }); } return menuBar; }
From source file:ca.phon.app.session.editor.view.session_information.SessionInfoEditorView.java
@Override public JMenu getMenu() { final JMenu menu = new JMenu(); menu.add(new BrowseForMediaAction(getEditor(), this)); menu.addSeparator(); final Session session = getEditor().getSession(); for (Participant p : session.getParticipants()) { final JMenu speakerMenu = new JMenu(p.getName()); speakerMenu.add(new EditParticipantAction(getEditor(), this, p)); speakerMenu.add(new DeleteParticipantAction(getEditor(), this, p)); menu.add(speakerMenu);/*w w w . jav a 2 s . c om*/ } menu.add(new NewParticipantAction(getEditor(), this)); return menu; }
From source file:TextComponentDemo.java
protected JMenu createEditMenu() { JMenu menu = new JMenu("Edit"); // Undo and redo are actions of our own creation. undoAction = new UndoAction(); menu.add(undoAction);/*from w ww . ja va 2s. c o m*/ redoAction = new RedoAction(); menu.add(redoAction); menu.addSeparator(); // These actions come from the default editor kit. // Get the ones we want and stick them in the menu. menu.add(getActionByName(DefaultEditorKit.cutAction)); menu.add(getActionByName(DefaultEditorKit.copyAction)); menu.add(getActionByName(DefaultEditorKit.pasteAction)); menu.addSeparator(); menu.add(getActionByName(DefaultEditorKit.selectAllAction)); return menu; }
From source file:be.fedict.eid.tsl.tool.TslTool.java
private void initFileMenu(JMenuBar menuBar) { JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic(KeyEvent.VK_F); menuBar.add(fileMenu);/*w ww . j a va 2s . c o m*/ initNewMenu(fileMenu); addActionMenuItem("Open", KeyEvent.VK_O, OPEN_ACTION_COMMAND, fileMenu); fileMenu.addSeparator(); this.signMenuItem = addActionMenuItem("Sign", KeyEvent.VK_S, SIGN_ACTION_COMMAND, fileMenu, false); this.saveMenuItem = addActionMenuItem("Save", KeyEvent.VK_A, SAVE_ACTION_COMMAND, fileMenu, false); this.saveAsMenuItem = addActionMenuItem("Save As", KeyEvent.VK_V, SAVE_AS_ACTION_COMMAND, fileMenu, false); this.exportMenuItem = addActionMenuItem("Export", KeyEvent.VK_E, EXPORT_ACTION_COMMAND, fileMenu, false); this.closeMenuItem = addActionMenuItem("Close", KeyEvent.VK_C, CLOSE_ACTION_COMMAND, fileMenu, false); fileMenu.addSeparator(); addActionMenuItem("Exit", KeyEvent.VK_X, EXIT_ACTION_COMMAND, fileMenu); }
From source file:com.mgmtp.jfunk.core.ui.JFunkFrame.java
private void buildMenuBar() { menuBar = new JMenuBar(); JMenu menu = new JMenu("File"); menu.setMnemonic('F'); menu.add(fileOpenScriptsAction);/*from www.java 2s . c om*/ menu.add(fileEditPropertiesAction); menu.addSeparator(); menu.add(fileExitAction); menuBar.add(menu); menu = new JMenu("Tools"); menu.setMnemonic('T'); menu.add(toolsRunAction); menuBar.add(menu); }
From source file:de.hstsoft.sdeep.view.MainWindow.java
private void createUI() { mapView = new MapView(); getContentPane().add(mapView, BorderLayout.CENTER); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar);/*from ww w . j ava 2s.c o m*/ JMenu mnFile = new JMenu("File"); menuBar.add(mnFile); JMenuItem mntmOpenSaveGame = new JMenuItem("Open Savegame"); mntmOpenSaveGame.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { openFileChooser(); } }); mnFile.add(mntmOpenSaveGame); mnFile.addSeparator(); JMenuItem mntmExit = new JMenuItem("Exit"); mntmExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); mnFile.add(mntmExit); JMenu mnView = new JMenu("View"); menuBar.add(mnView); final JCheckBoxMenuItem menuItemShowinfo = new JCheckBoxMenuItem("ShowInfo"); menuItemShowinfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { boolean showInfo = menuItemShowinfo.isSelected(); mapView.setShowInfo(showInfo); } }); menuItemShowinfo.setSelected(mapView.isShowInfo()); mnView.add(menuItemShowinfo); final JCheckBoxMenuItem menuItemShowgrid = new JCheckBoxMenuItem("ShowGrid"); menuItemShowgrid.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { boolean showGrid = menuItemShowgrid.isSelected(); mapView.setShowGrid(showGrid); } }); menuItemShowgrid.setSelected(mapView.isShowGrid()); mnView.add(menuItemShowgrid); final JCheckBoxMenuItem menuItemNotes = new JCheckBoxMenuItem("ShowNotes"); menuItemNotes.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { boolean showNotes = menuItemNotes.isSelected(); mapView.setShowNotes(showNotes); } }); menuItemNotes.setSelected(mapView.isShowNotes()); mnView.add(menuItemNotes); final JCheckBoxMenuItem menuItemAnimals = new JCheckBoxMenuItem("ShowAnimals"); menuItemAnimals.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { boolean showAnimals = menuItemAnimals.isSelected(); mapView.setShowAnimals(showAnimals); } }); menuItemAnimals.setSelected(mapView.isShowAnimals()); mnView.add(menuItemAnimals); mnView.addSeparator(); menuItemFileWatcher = new JCheckBoxMenuItem("Auto refresh"); menuItemFileWatcher.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { boolean enabled = menuItemFileWatcher.isSelected(); toggleAutoRefresh(enabled); } }); mnView.add(menuItemFileWatcher); mnView.addSeparator(); JMenuItem menuItemResetView = new JMenuItem("Reset view"); menuItemResetView.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { mapView.resetView(); } }); mnView.add(menuItemResetView); JMenu mnInfo = new JMenu("Info"); menuBar.add(mnInfo); JMenuItem mntmInfo = new JMenuItem("About"); mntmInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { showInfo(); } }); mnInfo.add(mntmInfo); }
From source file:TextComponentDemo.java
protected JMenu createEditMenu() { JMenu menu = new JMenu("Edit"); //Undo and redo are actions of our own creation. undoAction = new UndoAction(); menu.add(undoAction);// w w w . j a va 2s.com redoAction = new RedoAction(); menu.add(redoAction); menu.addSeparator(); //These actions come from the default editor kit. //Get the ones we want and stick them in the menu. menu.add(getActionByName(DefaultEditorKit.cutAction)); menu.add(getActionByName(DefaultEditorKit.copyAction)); menu.add(getActionByName(DefaultEditorKit.pasteAction)); menu.addSeparator(); menu.add(getActionByName(DefaultEditorKit.selectAllAction)); return menu; }
From source file:daylightchart.gui.DaylightChartGui.java
private void createActions(final JMenuBar menuBar, final JToolBar toolBar) { final JMenu menu = new JMenu(Messages.getString("DaylightChartGui.Menu.Actions")); //$NON-NLS-1$ menu.setMnemonic('A'); for (final LocationsListOperation operation : LocationsListOperation.values()) { final GuiAction action = operation.getAction(this); menu.add(action);/* www. ja va2s. c om*/ } menu.addSeparator(); menu.add(new GetCountriesFilesAction()); menu.add(new GetUSStatesFilesAction()); menu.addSeparator(); menu.add(new CloseCurrentTabAction(locationsTabbedPane)); menuBar.add(menu); }
From source file:fi.smaa.jsmaa.gui.SMAATRIGUIFactory.java
private JMenu buildCategoryMenu() { JMenu categoryMenu = new JMenu("Categories"); categoryMenu.setMnemonic('t'); JMenuItem showItem = new JMenuItem("Show"); showItem.setMnemonic('s'); JMenuItem addCatButton = createAddCatMenuItem(); showItem.addActionListener(new AbstractAction() { public void actionPerformed(ActionEvent e) { Focuser.focus(tree, treeModel, treeModel.getCategoriesNode()); }//from w w w . ja v a2 s . co m }); categoryMenu.add(showItem); categoryMenu.addSeparator(); categoryMenu.add(addCatButton); return categoryMenu; }
From source file:daylightchart.gui.DaylightChartGui.java
private void createFileMenu(final JMenuBar menuBar, final JToolBar toolBar) { final GuiAction openLocationsFile = new OpenLocationsFileAction(this); final GuiAction saveLocationsFile = new SaveLocationsFileAction(this); final GuiAction saveChart = new SaveChartAction(this); final GuiAction printChart = new PrintChartAction(locationsTabbedPane); final ExitAction exit = new ExitAction(this, Messages.getString("DaylightChartGui.Menu.File.Exit")); //$NON-NLS-1$ final JMenu menu = new JMenu(Messages.getString("DaylightChartGui.Menu.File")); //$NON-NLS-1$ menu.setMnemonic('F'); recentLocationsMenu = new JMenu(Messages.getString("DaylightChartGui.Menu.File.RecentLocations")); //$NON-NLS-1$ menu.setMnemonic('R'); menu.add(openLocationsFile);/* w w w .j av a 2s . c o m*/ menu.add(saveLocationsFile); menu.addSeparator(); menu.add(saveChart); if (!isSlimUi()) { menu.add(printChart); } menu.addSeparator(); menu.add(recentLocationsMenu); menu.addSeparator(); menu.add(exit); menuBar.add(menu); toolBar.add(openLocationsFile); toolBar.add(saveLocationsFile); toolBar.addSeparator(); toolBar.add(saveChart); toolBar.add(printChart); toolBar.addSeparator(); }