List of usage examples for javax.swing JMenu add
public JMenuItem add(Action a)
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.navegacao_cego.PainelSimuladorNavegacao.java
private JMenuBar criaMenuBar() { menuBar = new JMenuBar(); menuBar.setBackground(parentFrame.corDefault); JMenu menuArquivo = new JMenu(GERAL.ARQUIVO); menuArquivo.setMnemonic('A'); menuArquivo.setMnemonic(KeyEvent.VK_A); menuArquivo.setBackground(parentFrame.corDefault); JMenu avaliadores = new JMenu(); MenuSilvinha menuSilvinha = new MenuSilvinha(parentFrame, null); menuSilvinha.criaMenuAvaliadores(avaliadores); // menuArquivo.add(avaliadores); // menuArquivo.add(new JSeparator()); JMenuItem btnAbrir = new JMenuItem(GERAL.BTN_ABRIR); btnAbrir.addActionListener(this); btnAbrir.setActionCommand("Abrir"); btnAbrir.setMnemonic('A'); btnAbrir.setAccelerator(//from www. j a va 2 s .c o m javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, ActionEvent.CTRL_MASK)); btnAbrir.setMnemonic(KeyEvent.VK_A); btnAbrir.setToolTipText(TradSimuladorNavegacao.DICA_ABRE_E_AVALIA); btnAbrir.getAccessibleContext().setAccessibleDescription(TradSimuladorNavegacao.DICA_ABRE_E_AVALIA); menuArquivo.add(btnAbrir); JMenuItem btnAbrirUrl = new JMenuItem(XHTML_Panel.BTN_ABRIR_URL); btnAbrirUrl.addActionListener(this); btnAbrirUrl.setActionCommand("AbrirURL"); btnAbrirUrl.setMnemonic('U'); btnAbrirUrl.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, ActionEvent.CTRL_MASK)); btnAbrirUrl.setMnemonic(KeyEvent.VK_U); btnAbrirUrl.setToolTipText(XHTML_Panel.DICA_ABRIR); btnAbrirUrl.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_ABRIR); menuArquivo.add(btnAbrirUrl); btnSalvar = new JMenuItem(GERAL.BTN_SALVAR); btnSalvar.addActionListener(this); btnSalvar.setActionCommand("Salvar"); btnSalvar.setMnemonic('S'); btnSalvar.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, ActionEvent.CTRL_MASK)); btnSalvar.setMnemonic(KeyEvent.VK_S); btnSalvar.getAccessibleContext().setAccessibleDescription(TradSimuladorNavegacao.DICA_GRAVA_E_REAVALIA); // menuArquivo.add(btnSalvar); JMenuItem btnSalvarAs = new JMenuItem(GERAL.BTN_SALVAR_COMO); btnSalvarAs.addActionListener(this); btnSalvarAs.setActionCommand("SaveAs"); btnSalvarAs.setMnemonic('c'); btnSalvarAs.setMnemonic(KeyEvent.VK_C); // btnSalvarAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, // ActionEvent.CTRL_MASK)); btnSalvarAs.setToolTipText(GERAL.DICA_SALVAR_COMO); btnSalvarAs.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR_COMO); // menuArquivo.add(btnSalvarAs); menuArquivo.add(new JSeparator()); JMenuItem btnFechar = new JMenuItem(GERAL.SAIR); //btnFechar.addActionListener(this); btnFechar.setActionCommand("Sair"); //btnFechar.setMnemonic(KeyEvent.VK_X); btnFechar.setToolTipText(GERAL.DICA_SAIR); //btnFechar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SAIR); menuArquivo.add(btnFechar); btnFechar.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK)); btnFechar.setMnemonic('X'); btnFechar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); menuBar.add(menuArquivo); menuBar.add(this.criaMenuEditar()); menuBar.add(avaliadores); JMenu menuSimuladores = new JMenu(); menuSilvinha.criaMenuSimuladores(menuSimuladores); menuBar.add(menuSimuladores); JMenu mnFerramenta = new JMenu(); menuSilvinha.criaMenuFerramentas(mnFerramenta); menuBar.add(mnFerramenta); JMenu menuAjuda = new JMenu(GERAL.AJUDA); menuSilvinha.criaMenuAjuda(menuAjuda); menuBar.add(menuAjuda); return menuBar; }
From source file:blue.automation.AutomationManager.java
public JPopupMenu getAutomationMenu(SoundLayer soundLayer) { this.selectedSoundLayer = soundLayer; // if (menu == null || dirty) { JPopupMenu menu = new JPopupMenu(); // Build Instrument Menu JMenu instrRoot = new JMenu("Instrument"); Arrangement arrangement = data.getArrangement(); ParameterIdList paramIdList = soundLayer.getAutomationParameters(); for (int i = 0; i < arrangement.size(); i++) { InstrumentAssignment ia = arrangement.getInstrumentAssignment(i); if (ia.enabled && ia.instr instanceof Automatable) { ParameterList params = ((Automatable) ia.instr).getParameterList(); if (params.size() <= 0) { continue; }/*from w w w. j a v a 2 s.co m*/ JMenu instrMenu = new JMenu(); instrMenu.setText(ia.arrangementId + ") " + ia.instr.getName()); for (int j = 0; j < params.size(); j++) { Parameter param = params.getParameter(j); JMenuItem paramItem = new JMenuItem(); paramItem.setText(param.getName()); paramItem.addActionListener(parameterActionListener); if (param.isAutomationEnabled()) { if (paramIdList.contains(param.getUniqueId())) { paramItem.setForeground(Color.GREEN); } else { paramItem.setForeground(Color.ORANGE); } } paramItem.putClientProperty("instr", ia.instr); paramItem.putClientProperty("param", param); instrMenu.add(paramItem); } instrRoot.add(instrMenu); } } menu.add(instrRoot); // Build Mixer Menu Mixer mixer = data.getMixer(); if (mixer.isEnabled()) { JMenu mixerRoot = new JMenu("Mixer"); // add channels ChannelList channels = mixer.getChannels(); if (channels.size() > 0) { JMenu channelsMenu = new JMenu("Channels"); for (int i = 0; i < channels.size(); i++) { channelsMenu.add(buildChannelMenu(channels.getChannel(i), soundLayer)); } mixerRoot.add(channelsMenu); } // add subchannels ChannelList subChannels = mixer.getSubChannels(); if (subChannels.size() > 0) { JMenu subChannelsMenu = new JMenu("Sub-Channels"); for (int i = 0; i < subChannels.size(); i++) { subChannelsMenu.add(buildChannelMenu(subChannels.getChannel(i), soundLayer)); } mixerRoot.add(subChannelsMenu); } // add master channel Channel master = mixer.getMaster(); mixerRoot.add(buildChannelMenu(master, soundLayer)); menu.add(mixerRoot); } menu.addSeparator(); JMenuItem clearAll = new JMenuItem("Clear All"); clearAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Object retVal = DialogDisplayer.getDefault().notify(new NotifyDescriptor.Confirmation( "Please Confirm Clearing All Parameter Data for this SoundLayer")); if (retVal == NotifyDescriptor.YES_OPTION) { ParameterIdList idList = selectedSoundLayer.getAutomationParameters(); Iterator iter = new ArrayList(idList.getParameters()).iterator(); while (iter.hasNext()) { String paramId = (String) iter.next(); Parameter param = getParameter(paramId); param.setAutomationEnabled(false); idList.removeParameterId(paramId); } } } }); menu.add(clearAll); clearAll.setEnabled(soundLayer.getAutomationParameters().size() > 0); // } // System.err.println(parameterMap); return menu; }
From source file:com.opendoorlogistics.studio.AppFrame.java
private JMenu initCreateScriptsMenu() { JMenu mnCreateScript = new JMenu("Create script"); mnCreateScript.setMnemonic('C'); for (ODLAction action : new ScriptWizardActions(getApi(), this, scriptManager.getAvailableFieldsQuery()) .createComponentActions(new WizardActionsCallback() { @Override/*from w w w.j a v a 2 s . c o m*/ public void onNewScript(Script script) { scriptManager.launchScriptEditor(script, null, null); } })) { mnCreateScript.add(action); } return mnCreateScript; }
From source file:com.qspin.qtaste.ui.MainPanel.java
protected void genMenu(final TestCaseTree tct) { final JFrame owner = this; JMenuBar menuBar = new JMenuBar(); JMenu tools = new JMenu("Tools"); tools.setMnemonic(KeyEvent.VK_T); // Tools|Config menu item JMenuItem config = new JMenuItem("Config", KeyEvent.VK_D); config.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //ATEConfigEditPanel configPanel = new ATEConfigEditPanel(null); //configPanel.setVisible(true); MainConfigFrame configFrame = new MainConfigFrame(); configFrame.launch();/* w ww . j a va 2s .c o m*/ configFrame.addWindowListener(new WindowListener() { public void windowOpened(WindowEvent e) { } public void windowClosing(WindowEvent e) { } public void windowClosed(WindowEvent e) { // refresh the Configuration information display refreshParams(); } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } }); } }); tools.add(config); // Tools|delete results menu item JMenuItem deleteResults = new JMenuItem("Delete Results", KeyEvent.VK_D); final MainPanel ui = this; deleteResults.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String baseDir = TestEngineConfiguration.getInstance().getString("reporting.generated_report_path"); new File(baseDir, baseDir); // TO DO : delete really the files JOptionPane.showMessageDialog(ui, "Results have been deleted"); } }); tools.add(deleteResults); JMenu fileMenu = new JMenu("File"); JMenuItem importTestSuites = new JMenuItem("Import TestSuites"); importTestSuites.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // mTestCasePanel.importTestSuites(); } }); fileMenu.add(importTestSuites); JMenu help = new JMenu("Help"); help.setMnemonic(KeyEvent.VK_H); JMenuItem about = new JMenuItem("About", KeyEvent.VK_A); about.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new AboutDialog(owner); } }); help.add(about); JMenuItem ateUserManuel = new JMenuItem("User Manual"); ateUserManuel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { viewQTasteUserManuel(); } }); help.add(ateUserManuel); //menuBar.add(tools); // not to be used at this time!!!!!!!!! //menuBar.add(fileMenu); menuBar.add(help); setJMenuBar(menuBar); }
From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_link.java
@Override public void doPopup(final MouseEvent e, final int row, final Object itemId) { JPopupMenu popup = new JPopupMenu(); final ITableRowFilter rf = callback.getVisualizationState().getTableRowFilter(); final List<Link> linkRowsInTheTable = getVisibleElementsInTable(); /* Add the popup menu option of the filters */ final List<Link> selectedLinks = (List<Link>) (List<?>) getSelectedElements().getFirst(); if (!selectedLinks.isEmpty()) { final JMenu submenuFilters = new JMenu("Filters"); final JMenuItem filterKeepElementsAffectedThisLayer = new JMenuItem( "This layer: Keep elements associated to this link traffic"); final JMenuItem filterKeepElementsAffectedAllLayers = new JMenuItem( "All layers: Keep elements associated to this link traffic"); submenuFilters.add(filterKeepElementsAffectedThisLayer); if (callback.getDesign().getNumberOfLayers() > 1) submenuFilters.add(filterKeepElementsAffectedAllLayers); filterKeepElementsAffectedThisLayer.addActionListener(new ActionListener() { @Override/* www . ja v a 2 s . c om*/ public void actionPerformed(ActionEvent e) { if (selectedLinks.size() > 1) throw new RuntimeException(); TBFToFromCarriedTraffic filter = new TBFToFromCarriedTraffic(selectedLinks.get(0), true); callback.getVisualizationState().updateTableRowFilter(filter); callback.updateVisualizationJustTables(); } }); filterKeepElementsAffectedAllLayers.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (selectedLinks.size() > 1) throw new RuntimeException(); TBFToFromCarriedTraffic filter = new TBFToFromCarriedTraffic(selectedLinks.get(0), false); callback.getVisualizationState().updateTableRowFilter(filter); callback.updateVisualizationJustTables(); } }); popup.add(submenuFilters); popup.addSeparator(); } if (callback.getVisualizationState().isNetPlanEditable()) { popup.add(getAddOption()); for (JComponent item : getExtraAddOptions()) popup.add(item); } if (!linkRowsInTheTable.isEmpty()) { if (callback.getVisualizationState().isNetPlanEditable()) { if (row != -1) { if (popup.getSubElements().length > 0) popup.addSeparator(); JMenuItem removeItem = new JMenuItem("Remove " + networkElementType); removeItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { NetPlan netPlan = callback.getDesign(); try { Link link = netPlan.getLinkFromId((long) itemId); link.remove(); callback.getVisualizationState() .recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals(); callback.updateVisualizationAfterChanges(Sets.newHashSet(NetworkElementType.LINK)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } catch (Throwable ex) { ErrorHandling.addErrorOrException(ex, getClass()); ErrorHandling.showErrorDialog("Unable to remove " + networkElementType); } } }); popup.add(removeItem); } addPopupMenuAttributeOptions(e, row, itemId, popup); JMenuItem removeItems = new JMenuItem("Remove all " + networkElementType + "s in table"); removeItems.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { NetPlan netPlan = callback.getDesign(); try { if (rf == null) netPlan.removeAllLinks(); else for (Link ee : linkRowsInTheTable) ee.remove(); callback.getVisualizationState() .recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals(); callback.updateVisualizationAfterChanges(Sets.newHashSet(NetworkElementType.LINK)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } catch (Throwable ex) { ex.printStackTrace(); ErrorHandling.showErrorDialog(ex.getMessage(), "Unable to remove all " + networkElementType + "s"); } } }); popup.add(removeItems); List<JComponent> extraOptions = getExtraOptions(row, itemId); if (!extraOptions.isEmpty()) { if (popup.getSubElements().length > 0) popup.addSeparator(); for (JComponent item : extraOptions) popup.add(item); } } List<JComponent> forcedOptions = getForcedOptions(); if (!forcedOptions.isEmpty()) { if (popup.getSubElements().length > 0) popup.addSeparator(); for (JComponent item : forcedOptions) popup.add(item); } } popup.show(e.getComponent(), e.getX(), e.getY()); }
From source file:ucar.unidata.idv.control.chart.ChartWrapper.java
/** * Add the default menu items/*w w w . j a v a 2s .c o m*/ * * * @param items List of menu items * * @return The items list */ protected List getPopupMenuItems(List items) { if (canDoParameters()) { items.add(GuiUtils.makeMenuItem("Add Field...", this, "addField")); } if (canDoJython() && (jython != null) && (jython.trim().length() > 0)) { items.add(GuiUtils.makeMenuItem("Apply Jython", this, "applyJython", jython)); } items.add(GuiUtils.makeMenuItem("Remove Chart", this, "removeDisplayComponent")); items.add(GuiUtils.MENU_SEPARATOR); items.add(GuiUtils.makeMenuItem("Save Image...", this, "doSaveImage")); items.add(GuiUtils.makeMenuItem("Save Movie...", this, "doSaveMovie")); if (canDoDriveTime()) { items.add(GuiUtils.MENU_SEPARATOR); final JCheckBoxMenuItem mi1 = new JCheckBoxMenuItem("Show Animation Times", showTime); items.add(mi1); mi1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { showTime = mi1.isSelected(); } }); final JCheckBoxMenuItem mi2 = new JCheckBoxMenuItem("Drive Animation Times", driveTime); items.add(mi2); mi2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { driveTime = mi2.isSelected(); } }); } if (canDoTimeFilters() && (getDisplayGroup() != null)) { List comps = getDisplayGroup().getAncestorGroup().findDisplayComponents(ChartWrapper.class); JMenu filterMenu = null; boolean didSep = false; if (timeFilterSource != null) { filterMenu = new JMenu("Time Subset"); didSep = true; items.add(GuiUtils.MENU_SEPARATOR); items.add(filterMenu); filterMenu.add(GuiUtils.makeMenuItem("Remove", ChartWrapper.this, "removeTimeFilterSource")); } for (int i = 0; i < comps.size(); i++) { ChartWrapper chartWrapper = (ChartWrapper) comps.get(i); if (chartWrapper.getTimeRanges() == null) { continue; } if (filterMenu == null) { filterMenu = new JMenu("Time Subset"); if (!didSep) { items.add(GuiUtils.MENU_SEPARATOR); } didSep = true; items.add(filterMenu); } filterMenu.add(GuiUtils.makeMenuItem("From: " + chartWrapper.getName(), ChartWrapper.this, "setTimeFilterSource", chartWrapper)); } } if (canDoTimeSelect() && (getDisplayGroup() != null)) { List comps = getDisplayGroup().getAncestorGroup().findDisplayComponents(ChartWrapper.class); JMenu filterMenu = null; boolean didSep = false; if (timeSelectSource != null) { filterMenu = new JMenu("Time Select"); didSep = true; items.add(GuiUtils.MENU_SEPARATOR); items.add(filterMenu); filterMenu.add(GuiUtils.makeMenuItem("Remove", ChartWrapper.this, "removeTimeSelectSource")); } for (int i = 0; i < comps.size(); i++) { ChartWrapper chartWrapper = (ChartWrapper) comps.get(i); if ((chartWrapper == this) || !chartWrapper.canBeASourceForTimeSelectionEvents()) { continue; } if (filterMenu == null) { filterMenu = new JMenu("Time Select"); if (!didSep) { items.add(GuiUtils.MENU_SEPARATOR); } didSep = true; items.add(filterMenu); } filterMenu.add(GuiUtils.makeMenuItem("From: " + chartWrapper.getName(), ChartWrapper.this, "setTimeSelectSource", chartWrapper)); } } items.add(GuiUtils.MENU_SEPARATOR); items.add(GuiUtils.makeMenuItem("Properties...", this, "showProperties")); return items; }
From source file:net.sourceforge.entrainer.gui.EntrainerFX.java
private JMenu getSocketMenu() { JMenu menu = new JMenu("External Sockets"); addMnemonic(menu, KeyEvent.VK_R); menu.add(getChangePortItem()); menu.add(getConnectorGuiItem());/*w w w . jav a 2 s . c o m*/ menu.add(getConnectSocketItem()); return menu; }
From source file:com.digitalgeneralists.assurance.ui.MainWindow.java
private void initializeComponent() { if (!this.initialized) { logger.info("Initializing the main window."); if (AssuranceUtils.getPlatform() == Platform.MAC) { System.setProperty("apple.laf.useScreenMenuBar", "true"); com.apple.eawt.Application macApplication = com.apple.eawt.Application.getApplication(); MacApplicationAdapter macAdapter = new MacApplicationAdapter(this); macApplication.addApplicationListener(macAdapter); macApplication.setEnabledPreferencesMenu(true); }//from w ww. j a va 2s .com this.setTitle(Application.applicationShortName); this.setDefaultCloseOperation(EXIT_ON_CLOSE); GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); this.topArea = new JTabbedPane(); this.scanLaunchPanel.setPreferredSize(new Dimension(600, 150)); this.scanHistoryPanel.setPreferredSize(new Dimension(600, 150)); this.topArea.addTab("Scan", this.scanLaunchPanel); this.topArea.addTab("History", this.scanHistoryPanel); this.resultsPanel.setPreferredSize(new Dimension(600, 400)); this.topArea.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { resultsPanel.resetPanel(); // NOTE: This isn't ideal. It feels brittle. if (topArea.getSelectedIndex() == viewHistoryMenuItemIndex) { viewHistoryMenuItem.setSelected(true); } else { viewScanMenuItem.setSelected(true); } } }); GridBagConstraints topPanelConstraints = new GridBagConstraints(); topPanelConstraints.anchor = GridBagConstraints.NORTH; topPanelConstraints.fill = GridBagConstraints.BOTH; topPanelConstraints.gridx = 0; topPanelConstraints.gridy = 0; topPanelConstraints.weightx = 1.0; topPanelConstraints.weighty = 0.33; topPanelConstraints.gridheight = 1; topPanelConstraints.gridwidth = 1; topPanelConstraints.insets = new Insets(0, 0, 0, 0); this.getContentPane().add(this.topArea, topPanelConstraints); GridBagConstraints resultsPanelConstraints = new GridBagConstraints(); resultsPanelConstraints.anchor = GridBagConstraints.SOUTH; resultsPanelConstraints.fill = GridBagConstraints.BOTH; resultsPanelConstraints.gridx = 0; resultsPanelConstraints.gridy = 1; resultsPanelConstraints.weightx = 1.0; resultsPanelConstraints.weighty = 0.67; resultsPanelConstraints.gridheight = 1; resultsPanelConstraints.gridwidth = 1; resultsPanelConstraints.insets = new Insets(0, 0, 0, 0); this.getContentPane().add(this.resultsPanel, resultsPanelConstraints); this.applicationDelegate.addEventObserver(ScanStartedEvent.class, this); this.applicationDelegate.addEventObserver(ScanCompletedEvent.class, this); this.applicationDelegate.addEventObserver(SetScanDefinitionMenuStateEvent.class, this); this.applicationDelegate.addEventObserver(SetScanResultsMenuStateEvent.class, this); this.applicationDelegate.addEventObserver(ApplicationConfigurationLoadedEvent.class, this); JMenu menu; JMenuItem menuItem; menuBar = new JMenuBar(); StringBuilder accessiblityLabel = new StringBuilder(128); if (AssuranceUtils.getPlatform() != Platform.MAC) { menu = new JMenu(Application.applicationShortName); menu.getAccessibleContext().setAccessibleDescription(accessiblityLabel.append("Actions for ") .append(Application.applicationShortName).append(" application").toString()); accessiblityLabel.setLength(0); menuBar.add(menu); menuItem = new JMenuItem(MainWindow.quitApplicationMenuLabel, KeyEvent.VK_Q); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext().setAccessibleDescription(accessiblityLabel.append("Close the ") .append(Application.applicationShortName).append(" application").toString()); accessiblityLabel.setLength(0); menuItem.addActionListener(this); menuItem.setActionCommand(AssuranceActions.quitApplicationAction); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(MainWindow.aboutApplicationMenuLabel); menuItem.getAccessibleContext().setAccessibleDescription( accessiblityLabel.append("Display information about this version of ") .append(Application.applicationShortName).append(".").toString()); accessiblityLabel.setLength(0); menuItem.addActionListener(this); menuItem.setActionCommand(AssuranceActions.aboutApplicationAction); menu.add(menuItem); } menu = new JMenu("Scan"); menu.setMnemonic(KeyEvent.VK_S); menu.getAccessibleContext().setAccessibleDescription("Actions for file scans"); menuBar.add(menu); menuItem = new JMenuItem(MainWindow.newScanDefinitonMenuLabel, KeyEvent.VK_N); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Create a new scan definition"); menuItem.addActionListener(this.scanLaunchPanel); menuItem.setActionCommand(AssuranceActions.newScanDefinitonAction); menu.add(menuItem); menuItem = new JMenuItem(MainWindow.deleteScanDefinitonMenuLabel, KeyEvent.VK_D); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext().setAccessibleDescription("Delete the selected scan definition"); menuItem.addActionListener(this.scanLaunchPanel); menuItem.setActionCommand(AssuranceActions.deleteScanDefinitonAction); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(MainWindow.scanMenuLabel, KeyEvent.VK_S); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext() .setAccessibleDescription("Launch a scan using the selected scan definition"); menuItem.addActionListener(this.scanLaunchPanel); menuItem.setActionCommand(AssuranceActions.scanAction); menu.add(menuItem); menuItem = new JMenuItem(MainWindow.scanAndMergeMenuLabel, KeyEvent.VK_M); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext().setAccessibleDescription( "Launch a scan using the selected scan definition and merge the results"); menuItem.addActionListener(this.scanLaunchPanel); menuItem.setActionCommand(AssuranceActions.scanAndMergeAction); menu.add(menuItem); menu = new JMenu("Results"); menu.setMnemonic(KeyEvent.VK_R); menu.getAccessibleContext().setAccessibleDescription("Actions for scan results"); menuBar.add(menu); menuItem = new JMenuItem(MainWindow.replaceSourceMenuLabel, KeyEvent.VK_O); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext() .setAccessibleDescription("Replace the source file with the target file"); menuItem.addActionListener(this.resultsPanel.getResultMenuListener()); menuItem.setActionCommand(AssuranceActions.replaceSourceAction); menu.add(menuItem); menuItem = new JMenuItem(MainWindow.replaceTargetMenuLabel, KeyEvent.VK_T); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext() .setAccessibleDescription("Replace the target file with the source file"); menuItem.addActionListener(this.resultsPanel.getResultMenuListener()); menuItem.setActionCommand(AssuranceActions.replaceTargetAction); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(MainWindow.sourceAttributesMenuLabel); menuItem.getAccessibleContext().setAccessibleDescription("View the source file attributes"); menuItem.addActionListener(this.resultsPanel.getResultMenuListener()); menuItem.setActionCommand(AssuranceActions.sourceAttributesAction); menu.add(menuItem); menuItem = new JMenuItem(MainWindow.targetAttributesMenuLabel); menuItem.getAccessibleContext().setAccessibleDescription("View the target file attributes"); menuItem.addActionListener(this.resultsPanel.getResultMenuListener()); menuItem.setActionCommand(AssuranceActions.targetAttributesAction); menu.add(menuItem); menu = new JMenu("View"); menu.setMnemonic(KeyEvent.VK_V); menu.getAccessibleContext().setAccessibleDescription( accessiblityLabel.append("Views within ").append(Application.applicationShortName).toString()); accessiblityLabel.setLength(0); menuBar.add(menu); ButtonGroup group = new ButtonGroup(); this.viewScanMenuItem = new JRadioButtonMenuItem(MainWindow.viewScanMenuLabel); this.viewScanMenuItem.addActionListener(this); this.viewScanMenuItem.setActionCommand(AssuranceActions.viewScanAction); this.viewScanMenuItem.setSelected(true); group.add(this.viewScanMenuItem); menu.add(this.viewScanMenuItem); this.viewHistoryMenuItem = new JRadioButtonMenuItem(MainWindow.viewHistoryMenuLabel); this.viewHistoryMenuItem.addActionListener(this); this.viewHistoryMenuItem.setActionCommand(AssuranceActions.viewHistoryAction); this.viewHistoryMenuItem.setSelected(true); group.add(this.viewHistoryMenuItem); menu.add(this.viewHistoryMenuItem); if (AssuranceUtils.getPlatform() != Platform.MAC) { menu = new JMenu("Tools"); menu.getAccessibleContext() .setAccessibleDescription(accessiblityLabel.append("Additional actions for ") .append(Application.applicationShortName).append(" application").toString()); accessiblityLabel.setLength(0); menuBar.add(menu); menuItem = new JMenuItem(MainWindow.settingsMenuLabel, KeyEvent.VK_COMMA); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, ActionEvent.CTRL_MASK)); menuItem.getAccessibleContext() .setAccessibleDescription(accessiblityLabel.append("Change settings for the ") .append(Application.applicationShortName).append(" application").toString()); accessiblityLabel.setLength(0); menuItem.addActionListener(this); menuItem.setActionCommand(AssuranceActions.displaySettingsAction); menu.add(menuItem); } this.setJMenuBar(menuBar); this.initialized = true; } }
From source file:net.sourceforge.entrainer.gui.EntrainerFX.java
private JMenu getEspMenu() { JMenu menu = new JMenu("EEG Signal Processing"); addMnemonic(menu, KeyEvent.VK_G); menu.add(getEspDeviceMenu()); menu.add(new JSeparator()); menu.add(chooseChannelMenu());/* w ww . ja va 2 s . c o m*/ menu.add(new JSeparator()); menu.add(getStartEspMenu()); menu.add(getStopEspMenu()); menu.add(new JSeparator()); menu.add(loadLabMenu()); menu.add(saveLabMenu()); menu.add(new JSeparator()); menu.add(showEspLabMenu()); setEspMenuItemsEnabled(); return menu; }
From source file:net.sourceforge.entrainer.gui.EntrainerFX.java
private void addMenu() { JMenuBar bar = new JMenuBar(); JMenu menu = new JMenu(FILE_MENU_NAME); addMnemonic(menu, KeyEvent.VK_F); menu.add(getStartItem()); menu.add(getStopItem());//from w w w. j a v a 2 s . c o m menu.add(new JSeparator()); menu.add(getLoadXmlItem()); menu.add(getClearXmlItem()); menu.add(getEditXmlItem()); menu.add(getNewXmlItem()); menu.add(new JSeparator()); menu.add(getExitItem()); bar.add(menu); bar.add(getLookAndFeels()); bar.add(intervalMenu); bar.add(getEspMenu()); bar.add(getSocketMenu()); JMenu help = new JMenu(HELP_MENU_NAME); addMnemonic(help, KeyEvent.VK_H); help.add(getAboutItem()); help.add(getLicenseItem()); help.add(getLocalDocItem()); help.add(getRemoteDocItem()); help.add(getSplashItem()); help.add(getSplashOnStartupItem()); bar.add(help); setJMenuBar(bar); }