Example usage for javax.swing JMenuItem addActionListener

List of usage examples for javax.swing JMenuItem addActionListener

Introduction

In this page you can find the example usage for javax.swing JMenuItem addActionListener.

Prototype

public void addActionListener(ActionListener l) 

Source Link

Document

Adds an ActionListener to the button.

Usage

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.corretor_eventos.PanelCorretorEventos.java

/**
 * Recria o menu editar do Frame Principal
 * /* w  w  w. j  a v  a  2s.  c  o m*/
 * @param menu
 * @return
 */
private JMenu criaMenuEditar(JMenu menu) {
    menu.removeAll();
    menu.setMnemonic('E');
    menu.setMnemonic(KeyEvent.VK_E);

    menu.add(new JMenuItemTeclaAtalho(textAreaSourceCode));

    menu.add(new JSeparator());

    JMenuItem btnContraste = new JMenuItem(XHTML_Panel.ALTERAR_CONTRASTE);
    btnContraste.addActionListener(this);
    btnContraste.setActionCommand("Contraste");
    // btnAumenta.setMnemonic('F');
    // btnAumenta.setMnemonic(KeyEvent.VK_F);
    // btnAumenta.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD,
    // ActionEvent.CTRL_MASK));
    btnContraste.setToolTipText(XHTML_Panel.DICA_CONTRASTE);
    btnContraste.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_CONTRASTE);
    menu.add(btnContraste);

    JMenuItem btnAumenta = new JMenuItem(XHTML_Panel.AUMENTA_FONTE);
    btnAumenta.addActionListener(this);
    btnAumenta.setActionCommand("AumentaFonte");
    // btnAumenta.setMnemonic('F');
    // btnAumenta.setMnemonic(KeyEvent.VK_F);
    btnAumenta.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, ActionEvent.CTRL_MASK));
    btnAumenta.setToolTipText(XHTML_Panel.DICA_AUMENTA_FONTE);
    btnAumenta.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_AUMENTA_FONTE);
    menu.add(btnAumenta);

    JMenuItem btnDiminui = new JMenuItem(XHTML_Panel.DIMINUI_FONTE);
    btnDiminui.addActionListener(this);
    btnDiminui.setActionCommand("DiminuiFonte");
    // btnDiminui.setMnemonic('F');
    // btnDiminui.setMnemonic(KeyEvent.VK_F);
    btnDiminui.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_SUBTRACT, ActionEvent.CTRL_MASK));
    btnDiminui.setToolTipText(XHTML_Panel.DICA_DIMINUI_FONTE);
    btnDiminui.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_DIMINUI_FONTE);
    menu.add(btnDiminui);

    menu.add(new JSeparator());

    JMenuItem btnProcurar = new JMenuItem(XHTML_Panel.PROCURAR);
    btnProcurar.addActionListener(this);
    btnProcurar.setActionCommand("Procurar");
    btnProcurar.setMnemonic('P');
    btnProcurar.setMnemonic(KeyEvent.VK_P);
    btnProcurar.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, ActionEvent.CTRL_MASK));
    btnProcurar.setToolTipText(XHTML_Panel.DICA_PROCURAR);
    btnProcurar.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_PROCURAR);
    menu.add(btnProcurar);

    JMenuItem btnSelecionarTudo = new JMenuItem(XHTML_Panel.SELECIONAR_TUDO);
    btnSelecionarTudo.addActionListener(this);
    btnSelecionarTudo.setActionCommand("SelecionarTudo");
    btnSelecionarTudo.setMnemonic('T');
    btnSelecionarTudo.setMnemonic(KeyEvent.VK_T);
    btnSelecionarTudo.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, ActionEvent.CTRL_MASK));
    btnSelecionarTudo.setToolTipText(XHTML_Panel.DICA_SELECIONAR_TUDO);
    btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_SELECIONAR_TUDO);
    menu.add(btnSelecionarTudo);

    JMenuItem btnDesfazer = new JMenuItem(XHTML_Panel.DESFAZER);
    btnDesfazer.addActionListener(this);
    btnDesfazer.setActionCommand("Desfazer");
    btnDesfazer.setMnemonic('z');
    btnDesfazer.setMnemonic(KeyEvent.VK_Z);
    btnDesfazer.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, ActionEvent.CTRL_MASK));
    btnDesfazer.setToolTipText(XHTML_Panel.DICA_DESFAZER);
    btnDesfazer.getAccessibleContext().setAccessibleDescription(XHTML_Panel.DICA_DESFAZER);

    menu.add(btnDesfazer);
    return menu;
}

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   ww  w .  j  a  v a 2 s.com
            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:gdt.jgui.entity.JEntityStructurePanel.java

/**
 * The default constructor.//  w w w. j a va2 s  .  co  m
 */
public JEntityStructurePanel() {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    scrollPane = new JScrollPane();
    add(scrollPane);
    popup = new JPopupMenu();
    popup.addPopupMenuListener(new PopupMenuListener() {
        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            popup.removeAll();
            JMenuItem facetsItem = new JMenuItem("Facets");
            popup.add(facetsItem);
            facetsItem.setHorizontalTextPosition(JMenuItem.RIGHT);
            facetsItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    //   System.out.println("EntityStructurePanel:renderer:component locator$="+nodeLocator$);
                    JEntityFacetPanel efp = new JEntityFacetPanel();
                    String efpLocator$ = efp.getLocator();
                    Properties locator = Locator.toProperties(selection$);
                    String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                    String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                    efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$);
                    efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, entityKey$);
                    JConsoleHandler.execute(console, efpLocator$);
                }
            });
            JMenuItem copyItem = new JMenuItem("Copy");
            popup.add(copyItem);
            copyItem.setHorizontalTextPosition(JMenuItem.RIGHT);
            copyItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    console.clipboard.clear();
                    String locator$ = (String) node.getUserObject();
                    if (locator$ != null)
                        console.clipboard.putString(locator$);
                }
            });

            if (!isFirst) {
                popup.addSeparator();
                JMenuItem excludeItem = new JMenuItem("Exclude");
                popup.add(excludeItem);
                excludeItem.setHorizontalTextPosition(JMenuItem.RIGHT);
                excludeItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Exclude ?",
                                "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                        if (response == JOptionPane.YES_OPTION) {
                            try {
                                Properties locator = Locator.toProperties(selection$);
                                String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                                String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                                Entigrator entigrator = console.getEntigrator(entihome$);
                                Sack component = entigrator.getEntityAtKey(entityKey$);
                                String[] sa = entigrator.ent_listContainers(component);
                                if (sa != null) {
                                    Sack container;
                                    for (String aSa : sa) {
                                        container = entigrator.getEntityAtKey(aSa);
                                        if (container != null)
                                            entigrator.col_breakRelation(container, component);
                                    }
                                }
                                JConsoleHandler.execute(console, JEntityStructurePanel.this.locator$);
                            } catch (Exception ee) {
                                Logger.getLogger(JEntityStructurePanel.class.getName()).info(ee.toString());
                            }
                        }
                    }
                });

                JMenuItem deleteItem = new JMenuItem("Delete");
                popup.add(deleteItem);
                deleteItem.setHorizontalTextPosition(JMenuItem.RIGHT);
                deleteItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?",
                                "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                        if (response == JOptionPane.YES_OPTION) {
                            try {
                                Properties locator = Locator.toProperties(selection$);
                                String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                                String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                                Entigrator entigrator = console.getEntigrator(entihome$);
                                Sack component = entigrator.getEntityAtKey(entityKey$);
                                entigrator.deleteEntity(component);
                                JConsoleHandler.execute(console, JEntityStructurePanel.this.locator$);
                            } catch (Exception ee) {
                                Logger.getLogger(JEntityStructurePanel.class.getName()).info(ee.toString());
                            }
                        }
                    }
                });
            }
            if (hasToInclude()) {
                popup.addSeparator();
                JMenuItem includeItem = new JMenuItem("Include");
                popup.add(includeItem);
                includeItem.setHorizontalTextPosition(JMenuItem.RIGHT);
                includeItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        include();
                        JConsoleHandler.execute(console, JEntityStructurePanel.this.locator$);
                    }
                });
            }
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent e) {
            // TODO Auto-generated method stub
        }
    });
}

From source file:jchrest.gui.Shell.java

private JMenu createShellMenu() {
    JMenuItem exit = new JMenuItem("Exit", new ImageIcon(Shell.class.getResource("icons/Stop16.gif")));
    exit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);/*  ww w .j a va  2  s  .  co  m*/
        }
    });

    JMenu menu = new JMenu("Shell");
    menu.setMnemonic(KeyEvent.VK_S);
    menu.add(new AboutAction(this));
    menu.getItem(0).setMnemonic(KeyEvent.VK_A);
    menu.add(new LookFeelAction(this));
    menu.getItem(1).setMnemonic(KeyEvent.VK_T);
    menu.add(new JSeparator());
    menu.add(exit);
    menu.getItem(3).setMnemonic(KeyEvent.VK_X);

    menu.getItem(0).setAccelerator(KeyStroke.getKeyStroke('A', java.awt.Event.CTRL_MASK, false));
    menu.getItem(3).setAccelerator(KeyStroke.getKeyStroke('X', java.awt.Event.CTRL_MASK, false));
    return menu;
}

From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.navegacao_cego.PainelSimuladorNavegacao.java

/**
 * Cria o menu editar do Frame Principal
 * /*from   w  w w  . j  a  v  a 2s.  c  o m*/
 * @param menu
 */
private JMenu criaMenuEditar() {
    JMenu menu = new JMenu(GERAL.EDITAR);
    menu.setBackground(parentFrame.corDefault);
    menu.setMnemonic('E');
    menu.setMnemonic(KeyEvent.VK_E);

    JMenuItem btnContraste = new JMenuItem(GERAL.BTN_ALTERAR_CONTRASTE);
    btnContraste.addActionListener(this);
    btnContraste.setActionCommand("Contraste");
    // btnAumenta.setMnemonic('F');
    // btnAumenta.setMnemonic(KeyEvent.VK_F);
    // btnAumenta.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD,
    // ActionEvent.CTRL_MASK));
    btnContraste.setToolTipText(GERAL.ALTERAR_CONTRASTE);
    btnContraste.getAccessibleContext().setAccessibleDescription(GERAL.ALTERAR_CONTRASTE);
    menu.add(btnContraste);

    JMenuItem btnAumenta = new JMenuItem(GERAL.AUMENTA_FONTE);
    btnAumenta.addActionListener(this);
    btnAumenta.setActionCommand("AumentaFonte");
    // btnAumenta.setMnemonic('F');
    // btnAumenta.setMnemonic(KeyEvent.VK_F);
    btnAumenta.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ADD, ActionEvent.CTRL_MASK));
    btnAumenta.setToolTipText(GERAL.DICA_AUMENTA_FONTE);
    btnAumenta.getAccessibleContext().setAccessibleDescription(GERAL.DICA_AUMENTA_FONTE);
    menu.add(btnAumenta);

    JMenuItem btnDiminui = new JMenuItem(GERAL.DIMINUI_FONTE);
    btnDiminui.addActionListener(this);
    btnDiminui.setActionCommand("DiminuiFonte");
    // btnDiminui.setMnemonic('F');
    // btnDiminui.setMnemonic(KeyEvent.VK_F);
    btnDiminui.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_SUBTRACT, ActionEvent.CTRL_MASK));
    btnDiminui.setToolTipText(GERAL.DICA_DIMINUI_FONTE);
    btnDiminui.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DIMINUI_FONTE);
    menu.add(btnDiminui);

    JMenuItem btnSelecionarTudo = new JMenuItem(GERAL.SELECIONAR_TUDO);
    btnSelecionarTudo.addActionListener(this);
    btnSelecionarTudo.setActionCommand("SelecionarTudo");
    btnSelecionarTudo.setMnemonic('T');
    btnSelecionarTudo.setMnemonic(KeyEvent.VK_T);
    btnSelecionarTudo.setAccelerator(
            javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, ActionEvent.CTRL_MASK));
    btnSelecionarTudo.setToolTipText(GERAL.DICA_SELECIONAR_TUDO);
    btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SELECIONAR_TUDO);
    menu.add(btnSelecionarTudo);
    menu.add(new JSeparator());
    /*
     * JMenuItem btnProcurar = new JMenuItem(GERAL.PROCURAR);
     * btnProcurar.addActionListener(this);
     * btnProcurar.setActionCommand("Procurar");
     * btnProcurar.setMnemonic('P'); btnProcurar.setMnemonic(KeyEvent.VK_P);
     * btnProcurar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F,
     * ActionEvent.CTRL_MASK));
     * btnProcurar.setToolTipText(GERAL.DICA_PROCURAR);
     * btnProcurar.getAccessibleContext().setAccessibleDescription(GERAL.DICA_PROCURAR);
     * menu.add(btnProcurar);
     * 
     * JMenuItem btnSelecionarTudo = new JMenuItem(GERAL.SELECIONAR_TUDO);
     * btnSelecionarTudo.addActionListener(this);
     * btnSelecionarTudo.setActionCommand("SelecionarTudo");
     * btnSelecionarTudo.setMnemonic('T');
     * btnSelecionarTudo.setMnemonic(KeyEvent.VK_T);
     * btnSelecionarTudo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T,
     * ActionEvent.CTRL_MASK));
     * btnSelecionarTudo.setToolTipText(GERAL.DICA_SELECIONAR_TUDO);
     * btnSelecionarTudo.getAccessibleContext().setAccessibleDescription(GERAL.DICA_SELECIONAR_TUDO);
     * menu.add(btnSelecionarTudo);
     * 
     * JMenuItem btnDesfazer = new JMenuItem(GERAL.DESFAZER);
     * btnDesfazer.addActionListener(this);
     * btnDesfazer.setActionCommand("Desfazer");
     * btnDesfazer.setMnemonic('z'); btnDesfazer.setMnemonic(KeyEvent.VK_Z);
     * btnDesfazer.getAccessibleContext().setAccessibleDescription(GERAL.DICA_DESFAZER);
     * btnDesfazer.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z,
     * ActionEvent.CTRL_MASK)); menu.add(btnDesfazer);
     * menu.setEnabled(true);
     */
    return menu;
}

From source file:gdt.jgui.entity.JEntityDigestDisplay.java

/**
 * Get the context menu./*from   ww  w  . ja  v  a  2  s .  co  m*/
 * @return the context menu.
 */
@Override
public JMenu getContextMenu() {
    JMenu menu = new JMenu("Context");
    menu.setName("Context");
    JMenuItem facetItem = new JMenuItem("Facets");
    facetItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Properties locator = Locator.toProperties(locator$);
            String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
            String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
            JEntityFacetPanel efp = new JEntityFacetPanel();
            String efpLocator$ = efp.getLocator();
            efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$);
            efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, entityKey$);
            JConsoleHandler.execute(console, efpLocator$);
        }
    });
    menu.add(facetItem);

    JMenuItem structureItem = new JMenuItem("Structure");
    structureItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Properties locator = Locator.toProperties(locator$);
            String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
            String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
            JEntityStructurePanel esp = new JEntityStructurePanel();
            String espLocator$ = esp.getLocator();
            espLocator$ = Locator.append(espLocator$, Entigrator.ENTIHOME, entihome$);
            espLocator$ = Locator.append(espLocator$, EntityHandler.ENTITY_KEY, entityKey$);
            JConsoleHandler.execute(console, espLocator$);

        }
    });
    menu.add(structureItem);

    JMenuItem refreshItem = new JMenuItem("Refresh");
    refreshItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Properties locator = Locator.toProperties(locator$);
            String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
            String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
            JEntityDigestDisplay edp = new JEntityDigestDisplay();
            String edpLocator$ = edp.getLocator();
            edpLocator$ = Locator.append(edpLocator$, Entigrator.ENTIHOME, entihome$);
            if (selection$ != null)
                edpLocator$ = Locator.append(edpLocator$, SELECTION, Locator.compressText(selection$));
            edpLocator$ = Locator.append(edpLocator$, EntityHandler.ENTITY_KEY, entityKey$);
            JConsoleHandler.execute(console, edpLocator$);
        }
    });
    menu.add(refreshItem);
    return menu;
}

From source file:net.sf.jabref.openoffice.OpenOfficePanel.java

public JMenuItem getMenuItem() {
    if (Globals.prefs.getBoolean(JabRefPreferences.SHOW_OO_PANEL)) {
        manager.show(getName());//from   w w  w  .j  a  v  a2  s. c o m
    }
    JMenuItem item = new JMenuItem(Localization.lang("OpenOffice/LibreOffice connection"),
            IconTheme.getImage("openoffice"));
    item.addActionListener(event -> manager.show(getName()));
    return item;
}

From source file:adams.gui.tools.FileMonitorPanel.java

/**
 * Creates a menu bar (singleton per panel object). Can be used in frames.
 *
 * @return      the menu bar/*from w  w  w.  ja v  a  2 s  .  c o m*/
 */
@Override
public JMenuBar getMenuBar() {
    JMenuBar result;
    JMenu menu;
    JMenu submenu;
    JMenuItem menuitem;

    if (m_MenuBar == null) {
        result = new JMenuBar();

        // File
        menu = new JMenu("File");
        result.add(menu);
        menu.setMnemonic('F');
        menu.addChangeListener((ChangeEvent e) -> updateMenu());

        menuitem = new JMenuItem("Open...", GUIHelper.getIcon("open.gif"));
        menuitem.setMnemonic('O');
        menuitem.setAccelerator(GUIHelper.getKeyStroke("ctrl pressed O"));
        menuitem.addActionListener((ActionEvent e) -> open());
        menu.add(menuitem);
        m_MenuItemOpen = menuitem;

        // File/Recent files
        submenu = new JMenu("Open recent");
        menu.add(submenu);
        m_RecentFilesHandler = new RecentFilesHandler<>(SESSION_FILE, 5, submenu);
        m_RecentFilesHandler.addRecentItemListener(new RecentItemListener<JMenu, File>() {
            public void recentItemAdded(RecentItemEvent<JMenu, File> e) {
                // ignored
            }

            public void recentItemSelected(RecentItemEvent<JMenu, File> e) {
                open(e.getItem());
            }
        });
        m_MenuItemOpenRecent = submenu;

        menu.addSeparator();

        menuitem = new JMenuItem("Close", GUIHelper.getIcon("exit.png"));
        menuitem.setMnemonic('C');
        menuitem.setAccelerator(GUIHelper.getKeyStroke("ctrl pressed Q"));
        menuitem.addActionListener((ActionEvent e) -> close());
        menu.add(menuitem);
        m_MenuItemClose = menuitem;

        // update menu
        m_MenuBar = result;
        updateMenu();
    } else {
        result = m_MenuBar;
    }

    return result;
}

From source file:DragPictureDemo2.java

public JMenuBar createMenuBar() {
    JMenuItem menuItem = null;
    JMenuBar menuBar = new JMenuBar();
    JMenu mainMenu = new JMenu("Edit");
    mainMenu.setMnemonic(KeyEvent.VK_E);
    TransferActionListener actionListener = new TransferActionListener();

    menuItem = new JMenuItem("Cut");
    menuItem.setActionCommand((String) TransferHandler.getCutAction().getValue(Action.NAME));
    menuItem.addActionListener(actionListener);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK));
    menuItem.setMnemonic(KeyEvent.VK_T);
    mainMenu.add(menuItem);/*  w  w  w  .j  ava2  s.c om*/
    menuItem = new JMenuItem("Copy");
    menuItem.setActionCommand((String) TransferHandler.getCopyAction().getValue(Action.NAME));
    menuItem.addActionListener(actionListener);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
    menuItem.setMnemonic(KeyEvent.VK_C);
    mainMenu.add(menuItem);
    menuItem = new JMenuItem("Paste");
    menuItem.setActionCommand((String) TransferHandler.getPasteAction().getValue(Action.NAME));
    menuItem.addActionListener(actionListener);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK));
    menuItem.setMnemonic(KeyEvent.VK_P);
    mainMenu.add(menuItem);

    menuBar.add(mainMenu);
    return menuBar;
}

From source file:it.unibas.spicygui.controllo.provider.intermediatezone.MyPopupProviderConnectionFunc.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   w w w. ja  v a  2s  .  co  m

    //
    //        itemConfidence = new JMenuItem();
    //        menu.add(itemConfidence);
    //
    //        itemImplied = new JCheckBoxMenuItem(NbBundle.getMessage(Costanti.class, Costanti.IMPLIED));
    //        menu.add(itemImplied);

    item = new JMenuItem(NbBundle.getMessage(Costanti.class, Costanti.DELETE_CONNECTION));
    item.setActionCommand(DELETE);
    item.addActionListener(this);
    menu.add(item);

}