List of usage examples for javax.swing JMenuItem addActionListener
public void addActionListener(ActionListener l)
ActionListener
to the button. From source file:com.haulmont.cuba.desktop.App.java
protected JComponent createMenuBar() { menuBar = new JMenuBar(); JMenu menu = new JMenu(messages.getMessage(AppConfig.getMessagesPack(), "mainMenu.file")); menuBar.add(menu);//from ww w .j av a 2 s .c o m JMenuItem item; item = new JMenuItem(messages.getMessage(AppConfig.getMessagesPack(), "mainMenu.disconnect")); item.addActionListener(new ValidationAwareActionListener() { @Override public void actionPerformedAfterValidation(ActionEvent e) { logout(); } }); menu.add(item); item = new JMenuItem(messages.getMessage(AppConfig.getMessagesPack(), "mainMenu.exit")); item.addActionListener(new ValidationAwareActionListener() { @Override public void actionPerformedAfterValidation(ActionEvent e) { exit(); } }); menu.add(item); MenuBuilder builder = new MenuBuilder(connection.getSession(), menuBar); builder.build(); if (isTestMode()) { menuBar.setName("menuBar"); } return menuBar; }
From source file:com.AandR.beans.plotting.LinePlotPanel.LinePlotPanel.java
private JMenuItem createMenuItem(String label, String actionCommand) { JMenuItem menuItem = new JMenuItem(label); menuItem.addActionListener(plotPanelListener); menuItem.setActionCommand(actionCommand); return menuItem; }
From source file:es.emergya.ui.gis.FleetControlMapViewer.java
@Override protected JPopupMenu getContextMenu() { JPopupMenu menu = new JPopupMenu(); menu.setBackground(Color.decode("#E8EDF6")); // Ttulo//from w w w . ja v a2 s. c o m final JMenuItem titulo = new JMenuItem(i18n.getString("map.menu.titulo.puntoGenerico")); titulo.setFont(LogicConstants.deriveBoldFont(10.0f)); titulo.setBackground(Color.decode("#A4A4A4")); titulo.setFocusable(false); menu.add(titulo); menu.addSeparator(); // Actualizar posicin final JMenuItem gps = new JMenuItem(i18n.getString("map.menu.gps"), KeyEvent.VK_P); gps.setIcon(LogicConstants.getIcon("menucontextual_icon_actualizargps")); menu.add(gps); gps.addActionListener(this); gps.setEnabled(false); menu.addSeparator(); // Mostrar ms cercanos final JMenuItem mmc = new JMenuItem(i18n.getString("map.menu.showNearest"), KeyEvent.VK_M); mmc.setIcon(LogicConstants.getIcon("menucontextual_icon_mascercano")); mmc.addActionListener(this); menu.add(mmc); // Centrar aqui final JMenuItem cent = new JMenuItem(i18n.getString("map.menu.centerHere"), KeyEvent.VK_C); cent.setIcon(LogicConstants.getIcon("menucontextual_icon_centrar")); cent.addActionListener(this); menu.add(cent); // Nueva Incidencia final JMenuItem newIncidence = new JMenuItem(i18n.getString("map.menu.newIncidence"), KeyEvent.VK_I); newIncidence.setIcon(LogicConstants.getIcon("menucontextual_icon_newIncidence")); newIncidence.addActionListener(this); menu.add(newIncidence); // Calcular ruta desde aqui final JMenuItem from = new JMenuItem(i18n.getString("map.menu.route.from"), KeyEvent.VK_D); from.setIcon(LogicConstants.getIcon("menucontextual_icon_origenruta")); from.addActionListener(this); menu.add(from); // Calcular ruta hasta aqui final JMenuItem to = new JMenuItem(i18n.getString("map.menu.route.to"), KeyEvent.VK_H); to.setIcon(LogicConstants.getIcon("menucontextual_icon_destinoruta")); to.addActionListener(this); menu.add(to); menu.addSeparator(); // Ver ficha [recurso / incidencia] final JMenuItem summary = new JMenuItem(i18n.getString("map.menu.summary"), KeyEvent.VK_F); summary.setIcon(LogicConstants.getIcon("menucontextual_icon_ficha")); summary.addActionListener(this); menu.add(summary); summary.setEnabled(false); menu.addPopupMenuListener(new PopupMenuListener() { @SuppressWarnings("unchecked") @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { eventOriginal = FleetControlMapViewer.this.mapView.lastMEvent; gps.setEnabled(false); summary.setEnabled(false); titulo.setText(i18n.getString("map.menu.titulo.puntoGenerico")); menuObjective = null; Point p = new Point(mapView.lastMEvent.getX(), mapView.lastMEvent.getY()); for (Layer l : mapView.getAllLayers()) { // por cada capa... if (l instanceof MarkerLayer) { // ...de marcadores for (Marker marker : ((MarkerLayer) l).data) { // miramos // los // marcadores if ((marker instanceof CustomMarker) && marker.containsPoint(p)) { // y si // estamos // pinchando // en uno CustomMarker m = (CustomMarker) marker; log.trace("Hemos pinchado en " + marker); switch (m.getType()) { case RESOURCE: Recurso r = (Recurso) m.getObject(); log.trace("Es un recurso: " + r); if (r != null) { menuObjective = r; if (r.getPatrullas() != null) { titulo.setText( i18n.getString(Locale.ROOT, "map.menu.titulo.recursoPatrulla", r.getIdentificador(), r.getPatrullas())); } else { titulo.setText(r.getIdentificador()); } gps.setEnabled(true); summary.setEnabled(true); } break; case INCIDENCE: Incidencia i = (Incidencia) m.getObject(); log.trace("Es una incidencia: " + i); if (i != null) { menuObjective = i; titulo.setText(i.getTitulo()); gps.setEnabled(false); summary.setEnabled(true); } break; case UNKNOWN: log.trace("Hemos pinchado en un marcador desconocido"); break; } } } } } } @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { } @Override public void popupMenuCanceled(PopupMenuEvent e) { } }); return menu; }
From source file:org.simbrain.plot.projection.ProjectionGui.java
/** * Creates the menu bar.//from ww w . ja v a 2 s. com */ private void createAttachMenuBar() { final JMenuBar bar = new JMenuBar(); final JMenu fileMenu = new JMenu("File"); for (Action action : actionManager.getOpenSavePlotActions()) { fileMenu.add(action); } fileMenu.addSeparator(); final JMenu exportImport = new JMenu("Export/Import..."); fileMenu.add(exportImport); exportImport.add(ProjectionPlotActions.getImportData(getWorkspaceComponent().getProjectionModel())); exportImport.addSeparator(); exportImport.add(ProjectionPlotActions.getExportDataHi(getWorkspaceComponent().getProjectionModel())); exportImport.add(ProjectionPlotActions.getExportDataLow(getWorkspaceComponent().getProjectionModel())); fileMenu.addSeparator(); fileMenu.add(new CloseAction(this.getWorkspaceComponent())); final JMenu editMenu = new JMenu("Edit"); final JMenuItem preferencesGeneral = new JMenuItem("General Preferences..."); preferencesGeneral.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { ProjectionPreferencesDialog dialog = new ProjectionPreferencesDialog( getWorkspaceComponent().getProjectionModel().getProjector()); dialog.pack(); dialog.setLocationRelativeTo(null); dialog.setVisible(true); } }); editMenu.add(preferencesGeneral); final JMenuItem colorPrefs = new JMenuItem("Datapoint Coloring..."); colorPrefs.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { DataPointColoringDialog dialog = new DataPointColoringDialog( getWorkspaceComponent().getProjectionModel()); dialog.pack(); dialog.setLocationRelativeTo(null); dialog.setVisible(true); } }); editMenu.add(colorPrefs); final JMenuItem dims = new JMenuItem("Set dimensions..."); dims.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { String dimensions = JOptionPane.showInputDialog("Dimensions:"); if (dimensions != null) { getWorkspaceComponent().getProjectionModel().getProjector().init(Integer.parseInt(dimensions)); } } }); // editMenu.add(dims); JMenu helpMenu = new JMenu("Help"); JMenuItem helpItem = new JMenuItem(helpAction); helpMenu.add(helpItem); bar.add(fileMenu); bar.add(editMenu); bar.add(helpMenu); getParentFrame().setJMenuBar(bar); }
From source file:medsavant.enrichment.app.OntologyAggregatePanel.java
private JPopupMenu createPopup() { JPopupMenu menu = new JPopupMenu(); SortableTreeTableModel model = (SortableTreeTableModel) tree.getModel(); final int[] selRows = tree.getSelectedRows(); JMenuItem posItem = new JMenuItem(String.format("<html>Filter by %s</html>", selRows.length == 1 ? "Ontology Term <i>" + model.getValueAt(selRows[0], 0) + "</i>" : "Selected Ontology Terms")); posItem.addActionListener(new ActionListener() { @Override/* w w w . j a va 2s . c o m*/ public void actionPerformed(ActionEvent ae) { ThreadController.getInstance().cancelWorkers(pageName); List<OntologyTerm> terms = new ArrayList<OntologyTerm>(); SortableTreeTableModel model = (SortableTreeTableModel) tree.getModel(); for (int r : selRows) { OntologyNode rowNode = (OntologyNode) model.getRowAt(r); terms.add(rowNode.term); } OntologyType ont = terms.get(0).getOntology(); GeneticsFilterPage.getSearchBar().loadFilters( OntologyFilterView.wrapState(OntologyFilter.ontologyToTitle(ont), ont, terms, false)); } }); menu.add(posItem); return menu; }
From source file:net.sf.jabref.gui.fieldeditors.FileListEditor.java
public FileListEditor(JabRefFrame frame, BibDatabaseContext databaseContext, String fieldName, String content, EntryEditor entryEditor) {//from w ww . j a v a 2 s.c o m this.frame = frame; this.databaseContext = databaseContext; this.fieldName = fieldName; this.entryEditor = entryEditor; label = new FieldNameLabel(fieldName); tableModel = new FileListTableModel(); setText(content); setModel(tableModel); JScrollPane sPane = new JScrollPane(this); setTableHeader(null); addMouseListener(new TableClickListener()); JButton add = new JButton(IconTheme.JabRefIcon.ADD_NOBOX.getSmallIcon()); add.setToolTipText(Localization.lang("New file link (INSERT)")); JButton remove = new JButton(IconTheme.JabRefIcon.REMOVE_NOBOX.getSmallIcon()); remove.setToolTipText(Localization.lang("Remove file link (DELETE)")); JButton up = new JButton(IconTheme.JabRefIcon.UP.getSmallIcon()); JButton down = new JButton(IconTheme.JabRefIcon.DOWN.getSmallIcon()); auto = new JButton(Localization.lang("Get fulltext")); JButton download = new JButton(Localization.lang("Download from URL")); add.setMargin(new Insets(0, 0, 0, 0)); remove.setMargin(new Insets(0, 0, 0, 0)); up.setMargin(new Insets(0, 0, 0, 0)); down.setMargin(new Insets(0, 0, 0, 0)); add.addActionListener(e -> addEntry()); remove.addActionListener(e -> removeEntries()); up.addActionListener(e -> moveEntry(-1)); down.addActionListener(e -> moveEntry(1)); auto.addActionListener(e -> autoSetLinks()); download.addActionListener(e -> downloadFile()); FormBuilder builder = FormBuilder.create() .layout(new FormLayout("fill:pref,1dlu,fill:pref,1dlu,fill:pref", "fill:pref,fill:pref")); builder.add(up).xy(1, 1); builder.add(add).xy(3, 1); builder.add(auto).xy(5, 1); builder.add(down).xy(1, 2); builder.add(remove).xy(3, 2); builder.add(download).xy(5, 2); panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(sPane, BorderLayout.CENTER); panel.add(builder.getPanel(), BorderLayout.EAST); TransferHandler transferHandler = new FileListEditorTransferHandler(frame, entryEditor, null); setTransferHandler(transferHandler); panel.setTransferHandler(transferHandler); // Add an input/action pair for deleting entries: getInputMap().put(KeyStroke.getKeyStroke("DELETE"), "delete"); getActionMap().put("delete", new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { int row = getSelectedRow(); removeEntries(); row = Math.min(row, getRowCount() - 1); if (row >= 0) { setRowSelectionInterval(row, row); } } }); // Add an input/action pair for inserting an entry: getInputMap().put(KeyStroke.getKeyStroke("INSERT"), "insert"); getActionMap().put("insert", new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { addEntry(); } }); // Add input/action pair for moving an entry up: getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.FILE_LIST_EDITOR_MOVE_ENTRY_UP), "move up"); getActionMap().put("move up", new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { moveEntry(-1); } }); // Add input/action pair for moving an entry down: getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.FILE_LIST_EDITOR_MOVE_ENTRY_DOWN), "move down"); getActionMap().put("move down", new AbstractAction() { @Override public void actionPerformed(ActionEvent actionEvent) { moveEntry(1); } }); JMenuItem openLink = new JMenuItem(Localization.lang("Open")); menu.add(openLink); openLink.addActionListener(e -> openSelectedFile()); JMenuItem openFolder = new JMenuItem(Localization.lang("Open folder")); menu.add(openFolder); openFolder.addActionListener(e -> { int row = getSelectedRow(); if (row >= 0) { FileListEntry entry = tableModel.getEntry(row); try { String path = ""; // absolute path if (Paths.get(entry.link).isAbsolute()) { path = Paths.get(entry.link).toString(); } else { // relative to file folder for (String folder : databaseContext.getFileDirectory()) { Path file = Paths.get(folder, entry.link); if (Files.exists(file)) { path = file.toString(); break; } } } if (!path.isEmpty()) { JabRefDesktop.openFolderAndSelectFile(path); } else { JOptionPane.showMessageDialog(frame, Localization.lang("File not found"), Localization.lang("Error"), JOptionPane.ERROR_MESSAGE); } } catch (IOException ex) { LOGGER.debug("Cannot open folder", ex); } } }); JMenuItem rename = new JMenuItem(Localization.lang("Move/Rename file")); menu.add(rename); rename.addActionListener(new MoveFileAction(frame, entryEditor, this, false)); JMenuItem moveToFileDir = new JMenuItem(Localization.lang("Move file to file directory")); menu.add(moveToFileDir); moveToFileDir.addActionListener(new MoveFileAction(frame, entryEditor, this, true)); JMenuItem deleteFile = new JMenuItem(Localization.lang("Delete local file")); menu.add(deleteFile); deleteFile.addActionListener(e -> { int row = getSelectedRow(); // no selection if (row != -1) { FileListEntry entry = tableModel.getEntry(row); // null if file does not exist Optional<File> file = FileUtil.expandFilename(databaseContext, entry.link); // transactional delete and unlink try { if (file.isPresent()) { Files.delete(file.get().toPath()); } removeEntries(); } catch (IOException ex) { JOptionPane.showMessageDialog(frame, Localization.lang("File permission error"), Localization.lang("Cannot delete file"), JOptionPane.ERROR_MESSAGE); LOGGER.warn("File permission error while deleting: " + entry.link, ex); } } }); adjustColumnWidth(); }
From source file:net.sf.jabref.gui.openoffice.OpenOfficePanel.java
public JMenuItem getMenuItem() { if (preferences.showPanel()) { manager.show(getName());/*from w w w. j av a 2s . co m*/ } JMenuItem item = new JMenuItem(Localization.lang("OpenOffice/LibreOffice connection"), IconTheme.getImage("openoffice")); item.addActionListener(event -> manager.show(getName())); return item; }
From source file:coolmap.application.widget.impl.WidgetUserGroup.java
private void init() { table.getTableHeader().setReorderingAllowed(false); table.setAutoCreateRowSorter(true);//from w w w . j a va 2 s . c om table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (isSelected) { return label; } if (column == 1) { try { label.setBackground( nodeColor.get(table.getModel().getValueAt(table.convertRowIndexToModel(row), 0))); } catch (Exception e) { } } else { label.setBackground(UI.colorWhite); } return label; } }); //Need a search box as well. // getContentPane().setLayout(new BorderLayout()); // getContentPane().add(new JScrollPane(table), BorderLayout.CENTER); JToolBar t = new JToolBar(); getContentPane().add(t, BorderLayout.NORTH); t.setFloatable(false); try { //also add an action to add group nodes JMenuItem item = new JMenuItem("selected row nodes"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { CoolMapObject o = CoolMapMaster.getActiveCoolMapObject(); if (o == null) { return; } ArrayList<Range<Integer>> selected = o.getCoolMapView().getSelectedRows(); ArrayList<VNode> selectedNodes = new ArrayList<>(); for (Range<Integer> r : selected) { for (int i = r.lowerEndpoint(); i < r.upperEndpoint(); i++) { selectedNodes.add(o.getViewNodeRow(i)); } } createNewGroup(selectedNodes); //create a group } }); WidgetMaster.getViewport().addPopupMenuItem("Create group", item, false); item = new JMenuItem("selected column nodes"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { CoolMapObject o = CoolMapMaster.getActiveCoolMapObject(); if (o == null) { return; } ArrayList<Range<Integer>> selected = o.getCoolMapView().getSelectedColumns(); ArrayList<VNode> selectedNodes = new ArrayList<>(); for (Range<Integer> r : selected) { for (int i = r.lowerEndpoint(); i < r.upperEndpoint(); i++) { selectedNodes.add(o.getViewNodeColumn(i)); } } createNewGroup(selectedNodes); } }); WidgetMaster.getViewport().addPopupMenuItem("Create group", item, false); } catch (Exception e) { // //Error handling. } }
From source file:ipnat.skel.Strahler.java
/** * Gets the analysis parameters from the user. * * @return {@code true} if the dialog input is valid and dialog was not * dismissed.// w w w .j a va 2 s . c o m */ boolean getSettings() { final EnhancedGenericDialog gd = new EnhancedGenericDialog("Strahler Analysis :: " + IPNAT.getVersion()); final Font headerFont = new Font("SansSerif", Font.BOLD, 12); gd.setSmartRecording(true); // Part 1. Main Options gd.setInsets(0, 0, 0); gd.addMessage("Tree Classification:", headerFont); gd.addCheckbox("Infer root end-points from rectangular ROI", protectRoot); gd.addCheckbox("Ignore single-point arbors (Isolated pixels)", erodeIsolatedPixels); // Part 2: Loop elimination gd.setInsets(25, 0, 0); gd.addMessage("Elimination of Skeleton Loops:", headerFont); gd.addChoice("Method:", AnalyzeSkeleton_.pruneCyclesModes, AnalyzeSkeleton_.pruneCyclesModes[pruneChoice]); // 8-bit grayscale is the only image type recognized by // AnalyzeSkeleton_, // so we'll provide the user with a pre-filtered list of valid choices final ArrayList<Integer> validIds = new ArrayList<Integer>(); final ArrayList<String> validTitles = new ArrayList<String>(); final int[] ids = WindowManager.getIDList(); for (int i = 0; i < ids.length; ++i) { final ImagePlus imp = WindowManager.getImage(ids[i]); if (imp.getBitDepth() == 8) { // TODO: ignore composites? validIds.add(ids[i]); validTitles.add(imp.getTitle()); } } gd.addChoice("8-bit grayscale image:", validTitles.toArray(new String[validTitles.size()]), title); // Part 3: Output gd.setInsets(25, 0, 0); gd.addMessage("Output Options:", headerFont); gd.addCheckbox("Display_iteration stack", outIS); gd.addCheckbox("Show detailed information", verbose); gd.addCheckbox("Tabular data only (no image output)", tabular); gd.addDialogListener(this); dialogItemChanged(gd, null); // update prompt // Add More>> dropdown menu final JPopupMenu popup = new JPopupMenu(); JMenuItem mi; mi = new JMenuItem("Online documentation"); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { IJ.runPlugIn("ij.plugin.BrowserLauncher", URL); } }); popup.add(mi); popup.addSeparator(); mi = new JMenuItem("List hIPNAT commands..."); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { IJ.runPlugIn("ij.plugin.BrowserLauncher", IPNAT.DOC_URL + "#List_of_commands"); } }); popup.add(mi); mi = new JMenuItem("About hIPNAT plugins..."); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { IJ.runPlugIn("ipnat.Help", ""); } }); popup.add(mi); gd.assignPopupToHelpButton(popup); gd.showDialog(); // Set grayscale image for intensity-based pruning of skel. loops. if (pruneChoice == AnalyzeSkeleton_.LOWEST_INTENSITY_VOXEL || pruneChoice == AnalyzeSkeleton_.LOWEST_INTENSITY_BRANCH) { grayscaleImp = WindowManager.getImage(validIds.get(grayscaleImpChoice)); } else { grayscaleImp = null; } return gd.wasOKed(); }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.corretor_eventos.PanelCorretorEventos.java
/** * Cria o menu/*from w ww . j a v a 2s. c om*/ * * @return o menu */ private JMenuBar criaMenuBar() { menuBar = new JMenuBar(); menuBar.setBackground(frameSilvinha.corDefault); JMenu menuArquivo = new JMenu(XHTML_Panel.ARQUIVO); menuArquivo.setMnemonic('A'); menuArquivo.setMnemonic(KeyEvent.VK_A); JMenu avaliadores = new JMenu(); MenuSilvinha menuSilvinha = new MenuSilvinha(frameSilvinha, null); menuSilvinha.criaMenuAvaliadores(avaliadores); // menuArquivo.add(avaliadores); // menuArquivo.add(new JSeparator()); JMenuItem btnAbrir = new JMenuItem(XHTML_Panel.BTN_ABRIR); btnAbrir.addActionListener(this); btnAbrir.setActionCommand("Abrir"); btnAbrir.setMnemonic('A'); btnAbrir.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, ActionEvent.CTRL_MASK)); btnAbrir.setMnemonic(KeyEvent.VK_A); btnAbrir.setToolTipText(XHTML_Panel.DICA_ABRIR); btnAbrir.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_ABRIR); 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); miBtnSalvar.addActionListener(this); miBtnSalvar.setActionCommand("Salvar"); miBtnSalvar.setMnemonic('S'); miBtnSalvar.setAccelerator( javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, ActionEvent.CTRL_MASK)); miBtnSalvar.setMnemonic(KeyEvent.VK_S); miBtnSalvar.getAccessibleContext().setAccessibleDescription(XHTML_Panel.BTN_SALVAR); miBtnSalvar.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_SALVAR); menuArquivo.add(miBtnSalvar); JMenuItem btnSalvarAs = new JMenuItem(XHTML_Panel.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(XHTML_Panel.DICA_SALVAR_COMO); btnSalvarAs.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_SALVAR_COMO); menuArquivo.add(btnSalvarAs); JMenuItem btnFechar = new JMenuItem(XHTML_Panel.SAIR); btnFechar.addActionListener(this); btnFechar.setActionCommand("Sair"); btnFechar.setMnemonic('a'); btnFechar.setMnemonic(KeyEvent.VK_A); btnFechar.setToolTipText(XHTML_Panel.DICA_SAIR); btnFechar.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_SAIR); menuArquivo.add(btnFechar); menuBar.add(menuArquivo); JMenu menuEditar = new JMenu(XHTML_Panel.EDITAR); menuBar.add(criaMenuEditar(menuEditar)); 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(XHTML_Panel.AJUDA); menuSilvinha.criaMenuAjuda(menuAjuda); menuBar.add(menuAjuda); return menuBar; }