List of usage examples for javax.swing JMenuItem JMenuItem
public JMenuItem()
JMenuItem
with no set text or icon. From source file:com.sec.ose.osi.ui.frm.main.JMenuMain.java
/** * This method initializes jMenuItemProperties * //from w w w. j av a2s .c o m * @return javax.swing.JMenuItem */ private JMenuItem getJMenuItemIdentify() { if (jMenuItemIdentify == null) { jMenuItemIdentify = new JMenuItem(); jMenuItemIdentify.setText("Identify"); jMenuItemIdentify.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { mEventHandler.handle(EventHandler.MAN_FILE_IDENTIFY); } }); } return jMenuItemIdentify; }
From source file:com.sec.ose.osi.ui.frm.main.JMenuMain.java
/** * This method initializes jMenuItemProperties * //from w w w . j av a 2 s. c o m * @return javax.swing.JMenuItem */ private JMenuItem getJMenuItemReport() { if (jMenuItemReport == null) { jMenuItemReport = new JMenuItem(); jMenuItemReport.setText("Report"); jMenuItemReport.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { mEventHandler.handle(EventHandler.MAN_FILE_REPORT); } }); } return jMenuItemReport; }
From source file:edu.pdi2.visual.PDI.java
private void initGUI() { try {/*from w w w . ja v a 2 s. c om*/ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(null); this.setTitle("Procesamiento Digital de Imagenes"); //$NON-NLS-1$ getContentPane().setBackground(new java.awt.Color(212, 208, 200)); this.setResizable(false); this.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { thisFocusGained(evt); } }); { jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); { jMenu1 = new JMenu(); jMenuBar1.add(jMenu1); jMenu1.setText("File"); //$NON-NLS-1$ { jMenuItem1 = new JMenuItem(); // jMenu1.add(jMenuItem1); jMenu1.add(getJMenuOpenImage()); jMenu1.add(getJSeparator1()); jMenu1.add(getJMenuItemExit()); jMenuItem1.setText("Open Image"); //$NON-NLS-1$ jMenuItem1.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent evt) { jMenuItem1MouseReleased(evt); } }); } } { jMenu3 = new JMenu(); jMenuBar1.add(jMenu3); jMenuBar1.add(getJMenuView()); jMenu3.setText("Options"); //$NON-NLS-1$ jMenu3.setEnabled(false); { jMenuItem3 = new JMenuItem(); jMenu3.add(getJMenuItem2()); jMenu3.add(jMenuItem3); jMenuItem3.setText("False Color Image"); //$NON-NLS-1$ jMenuItem3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { menuFalseColorActionPerformed(evt); } }); } { jMenuItem4 = new JMenuItem(); jMenu3.add(jMenuItem4); jMenuItem4.setText("Mesh"); //$NON-NLS-1$ jMenuItem4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jMenuItem4ActionPerformed(evt); } }); } { jMenu4 = new JMenu(); jMenu3.add(jMenu4); jMenu3.add(getJMenuItem5()); jMenu3.add(getJGenerarSignature()); jMenu4.setText("Image"); //$NON-NLS-1$ { jmiCorrectedReflectance = new JMenuItem(); jMenu4.add(jmiCorrectedReflectance); jmiCorrectedReflectance.setText("Corrected Reflectance"); //$NON-NLS-1$ jmiCorrectedReflectance.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed 1")); //$NON-NLS-1$ jmiCorrectedReflectance.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jmiCorrectedRadianceActionPerformed(evt); } }); } { jmiCorrectedRadiance = new JMenuItem(); jMenu4.add(jmiCorrectedRadiance); jmiCorrectedRadiance.setText("Corrected Radiance"); //$NON-NLS-1$ jmiCorrectedRadiance.setAccelerator(KeyStroke.getKeyStroke("ctrl pressed 2")); jmiCorrectedRadiance.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jmiCorrectedReflectanceActionPerformed(evt); } }); } } } } // First we create the instance of DisplayThumbnail with a 0.1 // scale. // dt.setBorder(BorderFactory.createTitledBorder("")); // We must register mouse motion listeners to it ! // Now we create the instance of DisplayJAI to show the region // corresponding to the viewport. // Set it size. { image = new JPanel(); getContentPane().add(image); image.setBounds(1, 10, 590, dHeight + 10); { dj = new DisplayJAIWithAnnotations(); image.add(dj); dj.setBounds(0, 0, dWidth, dHeight); dj.setPreferredSize(new Dimension(dWidth, dHeight)); dj.setMinimumSize(new Dimension(dWidth, dHeight)); dj.setMaximumSize(new Dimension(dWidth, dHeight)); dj.setBorder(BorderFactory.createTitledBorder("")); dj.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent evt) { djMousePressed(evt); } }); dj.addMouseMotionListener(new MouseMotionAdapter() { public void mouseMoved(MouseEvent evt) { djMouseMoved(evt); } public void mouseDragged(MouseEvent evt) { djMouseDragged(evt); } }); } getContentPane().add(getLatLon()); } pack(); this.setSize(604, 579); } catch (Exception e) { e.printStackTrace(); } }
From source file:au.org.ala.delta.intkey.ui.CharacterImageDialog.java
private void buildMenuItems() { ActionMap actionMap = Application.getInstance().getContext().getActionMap(CharacterImageDialog.class, this); _mnuItNextCharacter = new JMenuItem(); _mnuItNextCharacter.setAction(actionMap.get("viewNextCharacter")); _mnuControl.add(_mnuItNextCharacter); _mnuItPreviousCharacter = new JMenuItem(); _mnuItPreviousCharacter.setAction(actionMap.get("viewPreviousCharacter")); _mnuControl.add(_mnuItPreviousCharacter); }
From source file:com.sec.ose.osi.ui.frm.main.JMenuMain.java
private JMenuItem getJMenuItemExit() { if (jMenuItemExit == null) { jMenuItemExit = new JMenuItem(); jMenuItemExit.setText("Exit"); jMenuItemExit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { mEventHandler.handle(EventHandler.MAN_FILE_EXIT); }/*from w w w. j a v a2 s .co m*/ }); } return jMenuItemExit; }
From source file:au.org.ala.delta.editor.DeltaEditor.java
private JMenuBar buildMenus() { JMenuBar menuBar = new JMenuBar(); // File menu. This on is kind of special, in that it gets rebuilt each // time a file is opened. _fileMenu = new JMenu(); _fileMenu.setName("mnuFile"); buildFileMenu(_fileMenu);/*from w w w. j a va2 s. co m*/ menuBar.add(_fileMenu); // Edit Menu JMenu mnuEdit = buildEditMenu(); menuBar.add(mnuEdit); // Search Menu JMenu mnuSearch = buildSearchMenu(); menuBar.add(mnuSearch); // View Menu JMenu mnuView = buildViewMenu(); menuBar.add(mnuView); // Window menu _windowMenu = new JMenu(); _windowMenu.setName("mnuWindow"); buildWindowMenu(_windowMenu); menuBar.add(_windowMenu); JMenu mnuHelp = new JMenu(); mnuHelp.setName("mnuHelp"); JMenuItem mnuItHelpContents = new JMenuItem(); mnuItHelpContents.setName("mnuItHelpContents"); mnuHelp.add(mnuItHelpContents); mnuItHelpContents.addActionListener(_helpController.helpAction()); JMenuItem mnuItHelpOnSelection = new JMenuItem(IconHelper.createImageIcon("help_cursor.png")); mnuItHelpOnSelection.setName("mnuItHelpOnSelection"); mnuItHelpOnSelection.addActionListener(_helpController.helpOnSelectionAction()); mnuHelp.add(mnuItHelpOnSelection); javax.swing.Action openAboutAction = _actionMap.get("openAbout"); if (isMac()) { configureMacAboutBox(openAboutAction); } else { JMenuItem mnuItAbout = new JMenuItem(); mnuItAbout.setAction(openAboutAction); mnuHelp.addSeparator(); mnuHelp.add(mnuItAbout); } menuBar.add(mnuHelp); return menuBar; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.label.PainelLabel.java
private void initComponentsEscalavel(ArrayList<FerramentaLabelModel> erros) { LabelPanel.carregaTexto(TokenLang.LANG); JPanel regraFonteBtn = new JPanel(); regraFonteBtn.setLayout(new BorderLayout()); textAreaSourceCode = new G_TextAreaSourceCode(); textAreaSourceCode.setTipoHTML();/* w ww .ja va 2 s .c o m*/ //parentFrame.setJMenuBar(this.criaMenuBar()); // parentFrame.setTitle("Associador de rtulos"); tableLinCod = new TabelaCorrecaoLabel(erros); arTextPainelCorrecao = new ArTextPainelCorrecao(); salvar = new JButton(); salvar.setEnabled(false); //btnSalvar.setEnabled(false); abrir = new JButton(); cancelar = new JButton(); // panelLegenda = new JPanel(); salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar, new JMenuItem(), parentFrame); new OnChange(textAreaSourceCode, this); pnRegra = new JPanel(); lbRegras1 = new JLabel(); lbRegras2 = new JLabel(); pnParticRotulo = new JPanel(); spParticRotulo = new JScrollPane(); tArParticipRotulo = new TArParticipRotulo(); pnListaErros = new JPanel(); scrollPanetabLinCod = new JScrollPane(); pnBotoes = new JPanel(); adicionar = new JButton(); aplicarRotulo = new JButton(); conteudoParticRotulo = new ArrayList<String>(); // setJMenuBar(this.criaMenuBar()); // ======== this ======== // setTitle("Associe explicitamente os r\u00f3tulos aos respectivos // controles:"); setBackground(CoresDefault.getCorPaineis()); Container contentPane = this;// ?? contentPane.setLayout(new GridLayout(2, 1)); // ======== pnRegra ======== { pnRegra.setBorder(criaBorda(LabelPanel.TITULO_REGRA)); pnRegra.setLayout(new GridLayout(2, 1)); pnRegra.add(lbRegras1); lbRegras1.setText(LabelPanel.REGRAP1); lbRegras2.setText(LabelPanel.REGRAP2); lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); lbRegras2.setHorizontalAlignment(SwingConstants.CENTER); pnRegra.add(lbRegras1); pnRegra.add(lbRegras2); pnRegra.setPreferredSize(new Dimension(700, 60)); } // ======== pnDescricao ======== { // ---- Salvar ---- salvar.setText(GERAL.BTN_SALVAR); salvar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("btn_salvar.actionPerformed()"); salvarActionPerformed(e); } }); salvar.setToolTipText(GERAL.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleName(GERAL.DICA_SALVAR); salvar.setBounds(10, 0, 150, 25); abrir.setText(GERAL.BTN_ABRIR); abrir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AbrirActionPerformed(e); } }); abrir.setToolTipText(LabelPanel.DICA_ABRIR); abrir.getAccessibleContext().setAccessibleDescription(LabelPanel.DICA_ABRIR); abrir.getAccessibleContext().setAccessibleName(LabelPanel.DICA_ABRIR); abrir.setBounds(165, 0, 150, 25); cancelar.setText(LabelPanel.TELA_ANTERIOR); cancelar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelarActionPerformed(e); } }); cancelar.setToolTipText(LabelPanel.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleDescription(LabelPanel.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleName(LabelPanel.DICA_TELA_ANTERIOR); cancelar.setBounds(320, 0, 150, 25); // ======== pnParticRotulo ======== { pnParticRotulo.setBorder(criaBorda(LabelPanel.TITULO_PARTCP_DO_ROTULO)); pnParticRotulo.setLayout(new BorderLayout()); // ======== spParticRotulo ======== { spParticRotulo.setViewportView(tArParticipRotulo); } pnParticRotulo.add(spParticRotulo, BorderLayout.CENTER); pnParticRotulo.setPreferredSize(new Dimension(780, 80)); } // ======== pnListaErros ======== { pnListaErros.setBorder(criaBorda(LabelPanel.TITULO_TABELA)); pnListaErros.setLayout(new BorderLayout()); // ======== scrollPanetabLinCod ======== { scrollPanetabLinCod.setViewportView(tableLinCod); } pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER); } // ======== pnBotoes ======== { // pnBotoes.setBorder(criaBorda("")); pnBotoes.setLayout(null); // ---- adicionar ---- adicionar.setText(GERAL.BTN_ADICIONAR); adicionar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { adicionarActionPerformed(e); } }); adicionar.setToolTipText(LabelPanel.BTN_ADICIONAR_TOOLTIP); adicionar.getAccessibleContext().setAccessibleDescription(LabelPanel.BTN_ADICIONAR_TOOLTIP); adicionar.getAccessibleContext().setAccessibleName(LabelPanel.BTN_ADICIONAR_TOOLTIP); adicionar.setBounds(10, 5, 150, 25); pnBotoes.add(adicionar); // ---- aplicarRotulo ---- aplicarRotulo.setEnabled(false); aplicarRotulo.setText(LabelPanel.BTN_APLICAR_ROTULO); aplicarRotulo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarRotuloActionPerformed(e); } }); aplicarRotulo.setToolTipText(LabelPanel.BTN_APLICAR_ROTULO_TOOLTIP); aplicarRotulo.getAccessibleContext() .setAccessibleDescription(LabelPanel.BTN_APLICAR_ROTULO_TOOLTIP); aplicarRotulo.getAccessibleContext().setAccessibleName(LabelPanel.BTN_APLICAR_ROTULO_TOOLTIP); aplicarRotulo.setBounds(165, 5, 150, 25); pnBotoes.add(aplicarRotulo); } } /* * Colocar os controles */ pnRegra.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(pnRegra, BorderLayout.NORTH); textAreaSourceCode.setBorder(criaBorda("")); textAreaSourceCode.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(textAreaSourceCode, BorderLayout.CENTER); pnBotoes.setPreferredSize(new Dimension(600, 35)); pnBotoes.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(pnBotoes, BorderLayout.SOUTH); regraFonteBtn.setBackground(CoresDefault.getCorPaineis()); contentPane.add(regraFonteBtn); JPanel textoErrosBtn = new JPanel(); textoErrosBtn.setLayout(new BorderLayout()); pnParticRotulo.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnParticRotulo, BorderLayout.NORTH); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); JPanel pnSalvarCancelar = new JPanel(); pnSalvarCancelar.setLayout(null); pnSalvarCancelar.setPreferredSize(new Dimension(600, 35)); pnSalvarCancelar.add(salvar); pnSalvarCancelar.add(abrir); pnSalvarCancelar.add(cancelar); pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis()); if (!original) { reverter = new JButton("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); TxtBuffer.setContent(TxtBuffer.getContentOriginal()); parentFrame.showPainelFerramentaLabelPArq(TxtBuffer.getContentOriginal()); setVisible(true); } }); //reverter.setActionCommand("Reverter"); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); reverter.setBounds(485, 0, 150, 25); pnSalvarCancelar.add(reverter); } textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH); pnListaErros.setBackground(CoresDefault.getCorPaineis()); if (tableLinCod.getRowCount() == 0) tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); contentPane.setBackground(CoresDefault.getCorPaineis()); contentPane.add(textoErrosBtn); this.setVisible(true); }
From source file:com.orange.atk.graphAnalyser.LectureJATKResult.java
/** This method is called from within the constructor to * initialize the form./* w w w . j a v a 2 s . c om*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jListGraph = new JList(listModel); jComboBoxLeft = new JComboBox(comboModelLeft); jComboBoxRight = new JComboBox(comboModelRight); jListMarker = new JList(listModelMarker); jTable2 = new javax.swing.JTable(); jMenu1 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jComboBoxLeft.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxLeftActionPerformed(evt); } }); jComboBoxRight.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxRightActionPerformed(evt); } }); jTable2.setModel(modeltable); jMenu1.setText("File"); JMenuItem jMenuItem1 = new JMenuItem(); jMenuItem1.setText("Open Directory"); jMenuItem1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { openDirectoryAction(evt); } }); JMenuItem jMenuItem2 = new JMenuItem(); jMenuItem2.setText("Add a reference Graph"); jMenuItem2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jMenuItemaddGraphActionPerformed(evt); } }); JMenuItem jMenuItem3 = new JMenuItem(); jMenuItem3.setText("set Graph color"); jMenuItem3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemChangecolorActionPerformed(evt); } }); JMenuItem jMenuItem4 = new JMenuItem(); jMenuItem4.setText("save config file"); jMenuItem4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemSaveConfigFileActionPerformed(evt); } }); jMenu1.add(jMenuItem1); jMenu1.add(jMenuItem2); jMenu1.add(jMenuItem3); jMenu1.add(jMenuItem4); JMenuBar jMenuBar1 = new JMenuBar(); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); //organise JFRAME JPanel mainpanel = (JPanel) getContentPane(); mainpanel.setLayout(new BorderLayout()); mainpanel.add(chartPanel, BorderLayout.CENTER); JPanel toolPanel = new JPanel(); toolPanel.setLayout(new FlowLayout()); toolPanel.add(jComboBoxLeft); Box graphbox = Box.createVerticalBox(); graphbox.add(new JLabel("List of Graph ")); JScrollPane jspaneGraph = new JScrollPane(); jspaneGraph.setViewportView(jListGraph); jspaneGraph.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jspaneGraph.setPreferredSize(new Dimension(150, 100)); graphbox.add(jspaneGraph); // graphbox.setBorder(BorderFactory.createLineBorder(Color.black)); toolPanel.add(graphbox); Box markerbox = Box.createVerticalBox(); markerbox.add(new JLabel("List of Marker")); JScrollPane jspaneMarker = new JScrollPane(); jspaneMarker.setViewportView(jListMarker); jspaneMarker.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jspaneMarker.setPreferredSize(new Dimension(150, 100)); markerbox.add(jspaneMarker); // markerbox.setBorder(BorderFactory.createLineBorder(Color.black)); toolPanel.add(markerbox); JScrollPane jspane = new JScrollPane(); jspane.setViewportView(jTable2); jspane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); jspane.setPreferredSize(new Dimension(300, 100)); toolPanel.add(jspane); toolPanel.add(jComboBoxRight); mainpanel.add(toolPanel, BorderLayout.NORTH); pack(); }
From source file:com.sec.ose.osi.ui.frm.main.JMenuMain.java
/** * This method initializes jMenuItemProperties * /*from w w w . j a va2 s . c om*/ * @return javax.swing.JMenuItem */ private JMenuItem getJMenuItemProjectAnalysis() { if (jMenuItemProjectAnalysis == null) { jMenuItemProjectAnalysis = new JMenuItem(); jMenuItemProjectAnalysis.setText("Project Analysis"); jMenuItemProjectAnalysis.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { log.debug("Monitoring Interval menu click"); mEventHandler.handle(EventHandler.MAN_SETTING_MONITOR_INTERVAL); } }); } return jMenuItemProjectAnalysis; }
From source file:fi.hoski.remote.ui.Admin.java
private void menuFile() { JMenu fileMenu = new JMenu(); TextUtil.populate(fileMenu, "FILE"); menuBar.add(fileMenu);/*from w ww.jav a 2 s . co m*/ if (accessUser) { fileMenu.add(menuItemSync()); } if (privileged || isRaceAdmin) { fileMenu.add(menuItemTextMaintenence()); } if (privileged) { fileMenu.add(menuItemTextUpload()); fileMenu.add(menuItemTextDownload()); fileMenu.add(menuItemAttach()); fileMenu.add(menuItemRemoveAttachment()); } if (serverProperties.isZonerSMSSupported()) { fileMenu.add(menuItemSMSCredits()); } fileMenu.addSeparator(); if (privileged) { fileMenu.add(menuItemRemoveEntity()); fileMenu.add(menuItemRemoveYear()); fileMenu.addSeparator(); fileMenu.add(menuItemBackupEntity()); fileMenu.add(menuItemBackupYear()); fileMenu.addSeparator(); fileMenu.add(menuItemRestoreEntity()); fileMenu.add(menuItemRestore()); fileMenu.add(menuItemAddYear()); } fileMenu.addSeparator(); if (accessUser) { fileMenu.add(menuItemInspectAllLightBoats()); fileMenu.add(menuItemInspectionFix1()); fileMenu.add(menuItemSql()); fileMenu.add(menuItemUninspectedBoats()); } fileMenu.addSeparator(); JMenuItem exitItem = new JMenuItem(); TextUtil.populate(exitItem, "EXIT"); ActionListener exitAction = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { confirmSaveReservations(); System.exit(0); } }; exitAction = createActionListener(frame, exitAction); exitItem.addActionListener(exitAction); fileMenu.add(exitItem); }