List of usage examples for javax.swing JMenuItem setActionCommand
public void setActionCommand(String actionCommand)
From source file:Main.java
public JMenuBar createMenuBar() { JMenuBar top_menu_bar = new JMenuBar(); JMenu main_menu = new JMenu("Menu"); main_menu.setMnemonic(KeyEvent.VK_M); top_menu_bar.add(main_menu);/*from w ww . j a va 2 s . c o m*/ JMenuItem menu_item; menu_item = new JMenuItem("Add New"); menu_item.setMnemonic(KeyEvent.VK_N); menu_item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.ALT_MASK)); menu_item.setActionCommand("new"); menu_item.addActionListener(e -> createThumb()); main_menu.add(menu_item); return top_menu_bar; }
From source file:de.genvlin.plugins.jfreechart.JFreeChartPluginImpl.java
public void sendRequest(RequestEvent ri) { if (ri.getActionContextReason() == PluginPool.SELECTED_COLS) { selected = (VectorInterface[]) ((GTablePanel) ri.getSource()).getSelectedVectors(); JMenu menu = new JMenu(getName()); JMenuItem item = new JMenuItem(getMenuName()); item.setActionCommand(getMenuName()); menu.add(item);/*from w w w . j a va 2 s. com*/ item.addActionListener(this); item = new JMenuItem(LINEAR_REG); item.setActionCommand(LINEAR_REG); menu.add(item); item.addActionListener(this); ((JPopupMenu) ri.getObject()).add(menu); } }
From source file:it.unibas.spicygui.controllo.provider.MyPopupProviderConnectionSpicy.java
private void createPopupMenu() { menu = new JPopupMenu("Popup menu"); JMenuItem item; item = new JMenuItem(NbBundle.getMessage(Costanti.class, Costanti.SHOW_HIDE_INFO_CONNECTION)); item.setActionCommand(SHOW); item.addActionListener(this); menu.add(item);/*from www. j a v a 2 s . c om*/ item = new JMenuItem(NbBundle.getMessage(Costanti.class, Costanti.DELETE_CONNECTION)); item.setActionCommand(DELETE); item.addActionListener(this); menu.add(item); }
From source file:it.unibas.spicygui.controllo.provider.composition.MyPopupProviderConnectionMergeComposition.java
private void createPopupMenu() { menu = new JPopupMenu("Popup menu"); JMenuItem item; item = new JMenuItem(NbBundle.getMessage(Costanti.class, Costanti.DELETE_CONNECTION)); item.setActionCommand(DELETE); item.addActionListener(this); menu.add(item);/* www . j a v a2s. co m*/ }
From source file:it.unibas.spicygui.controllo.provider.intermediatezone.MyPopupProviderConnectionFunctionalDep.java
private void createPopupMenu() { menu = new JPopupMenu("Popup menu"); JMenuItem item; item = new JMenuItem(NbBundle.getMessage(Costanti.class, Costanti.DELETE_CONNECTION)); item.setActionCommand(DELETE); item.addActionListener(this); menu.add(item);//from w w w .j a va 2 s . c o m }
From source file:edu.gcsc.vrl.jfreechart.JFXPlotContainerType.java
protected void updateChartPanel(Container container, final JFreeChart jFreeChart) { if (chartPanel != null) { chartContainer.remove(chartPanel); }/*from w w w . j av a2 s .c om*/ chartPanel = new ChartPanel(jFreeChart); chartContainer.add(chartPanel); JPopupMenu menu = chartPanel.getPopupMenu(); menu.addSeparator(); JMenuItem item1 = new JMenuItem("Export"); item1.setActionCommand("export_chart"); item1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.equals("export_chart")) { try { new JFExport().openExportDialog(jFreeChart); } catch (Exception e1) { e1.printStackTrace(System.err); } } } }); menu.add(item1); revalidate(); }
From source file:org.simbrain.plot.piechart.PieChartGui.java
/** * Creates the menu bar./*from w ww . ja va 2s . c om*/ */ private void createAttachMenuBar() { JMenuBar bar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); for (Action action : actionManager.getOpenSavePlotActions()) { fileMenu.add(action); } fileMenu.addSeparator(); fileMenu.add(new CloseAction(this.getWorkspaceComponent())); JMenu editMenu = new JMenu("Edit"); JMenuItem preferences = new JMenuItem("Preferences..."); preferences.addActionListener(this); preferences.setActionCommand("dialog"); editMenu.add(preferences); JMenu helpMenu = new JMenu("Help"); ShowHelpAction helpAction = new ShowHelpAction("Pages/Plot/pie_chart.html"); JMenuItem helpItem = new JMenuItem(helpAction); helpMenu.add(helpItem); bar.add(fileMenu); bar.add(editMenu); bar.add(helpMenu); getParentFrame().setJMenuBar(bar); }
From source file:fi.elfcloud.client.tree.DataItemNode.java
private void populatePopupMenu(JPopupMenu menu, BeaverGUI gui) { JMenuItem item; item = new JMenuItem(Messages.getString("DataItemNode.popup_download")); //$NON-NLS-1$ item.setActionCommand(Integer.toString(gui.ACTION_SAVE_ITEM)); item.addActionListener(gui);/* w w w . j a v a2s. com*/ item.setIcon(new ImageIcon(BeaverGUI.class.getResource("icons/download16.png"))); //$NON-NLS-1$ menu.add(item); item = new JMenuItem(Messages.getString("DataItemNode.popup_modify")); //$NON-NLS-1$ item.setActionCommand(Integer.toString(gui.ACTION_MODIFY)); item.addActionListener(gui); item.setIcon(new ImageIcon(BeaverGUI.class.getResource("icons/modify_rename16.png"))); //$NON-NLS-1$ menu.add(item); item = new JMenuItem(Messages.getString("DataItemNode.popup_move")); //$NON-NLS-1$ item.setActionCommand(Integer.toString(gui.ACTION_MOVE)); item.setIcon(new ImageIcon(BeaverGUI.class.getResource("icons/move_file16.png"))); //$NON-NLS-1$ item.addActionListener(gui); menu.add(item); item = new JMenuItem(Messages.getString("DataItemNode.popup_information")); //$NON-NLS-1$ item.setIcon(new ImageIcon(BeaverGUI.class.getResource("icons/info_file16.png"))); //$NON-NLS-1$ item.setActionCommand(Integer.toString(gui.ACTION_INFORMATION)); item.addActionListener(gui); menu.add(item); menu.addSeparator(); item = new JMenuItem(Messages.getString("DataItemNode.popup_delete")); //$NON-NLS-1$ item.setActionCommand(Integer.toString(gui.ACTION_DELETE)); item.addActionListener(gui); item.setIcon(new ImageIcon(BeaverGUI.class.getResource("icons/delete16.png"))); //$NON-NLS-1$ menu.add(item); }
From source file:fi.elfcloud.client.tree.ClusterNode.java
private void populatePopupMenu(JPopupMenu menu, BeaverGUI gui) { JMenuItem item; item = new JMenuItem(Messages.getString("ClusterNode.popup_modify")); //$NON-NLS-1$ item.setActionCommand(Integer.toString(gui.ACTION_MODIFY)); item.addActionListener(gui);/*from www .j av a 2 s . c om*/ item.setIcon(new ImageIcon(BeaverGUI.class.getResource("icons/modify_rename16.png"))); //$NON-NLS-1$ menu.add(item); item = new JMenuItem(Messages.getString("ClusterNode.popup_information")); //$NON-NLS-1$ item.setIcon(new ImageIcon(BeaverGUI.class.getResource("icons/info_file16.png"))); //$NON-NLS-1$ item.setActionCommand(Integer.toString(gui.ACTION_INFORMATION)); item.addActionListener(gui); menu.add(item); menu.addSeparator(); item = new JMenuItem(Messages.getString("ClusterNode.popup_delete")); //$NON-NLS-1$ item.setActionCommand(Integer.toString(gui.ACTION_DELETE)); item.addActionListener(gui); item.setIcon(new ImageIcon(BeaverGUI.class.getResource("icons/delete16.png"))); //$NON-NLS-1$ menu.add(item); }
From source file:components.InternalFrameDemo.java
protected JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); //Set up the lone menu. JMenu menu = new JMenu("Document"); menu.setMnemonic(KeyEvent.VK_D); menuBar.add(menu);/*from w w w . ja va 2s . c o m*/ //Set up the first menu item. JMenuItem menuItem = new JMenuItem("New"); menuItem.setMnemonic(KeyEvent.VK_N); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.ALT_MASK)); menuItem.setActionCommand("new"); menuItem.addActionListener(this); menu.add(menuItem); //Set up the second menu item. menuItem = new JMenuItem("Quit"); menuItem.setMnemonic(KeyEvent.VK_Q); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)); menuItem.setActionCommand("quit"); menuItem.addActionListener(this); menu.add(menuItem); return menuBar; }