Example usage for javax.swing JMenu setMnemonic

List of usage examples for javax.swing JMenu setMnemonic

Introduction

In this page you can find the example usage for javax.swing JMenu setMnemonic.

Prototype

@BeanProperty(visualUpdate = true, description = "the keyboard character mnemonic")
public void setMnemonic(int mnemonic) 

Source Link

Document

Sets the keyboard mnemonic on the current model.

Usage

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

/**
 * Recria o menu editar do Frame Principal
 * // w ww.  jav  a2 s  .  c om
 * @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:ffx.ui.MainMenu.java

private JMenu addMenu(String name, char mnemonic) {
    JMenu menu = new JMenu(locale.getValue(name));
    add(menu);/*from w  w  w.  j a  va2  s.  co m*/
    if (mnemonic != '.') {
        menu.setMnemonic(mnemonic);
    }
    return menu;
}

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

/**
 * Cria o menu/*from   w  w w .ja  v a  2 s  . co m*/
 * 
 * @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;
}

From source file:ffx.ui.MainMenu.java

private JMenu addSubMenu(JMenu parent, String name, char mnemonic) {
    JMenu menu = new JMenu(locale.getValue(name));
    parent.add(menu);/*from w  w  w.  ja va2 s . co  m*/
    if (mnemonic != '.') {
        menu.setMnemonic(mnemonic);
    }
    menu.setIcon(blankIcon);
    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 w  ww.ja v  a2  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:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java

private JMenu getHelpMenu() {
    final JMenu helpMenu = new JMenu("Help");
    helpMenu.setMnemonic(KeyEvent.VK_H);

    // Pick a random message to display in the help menu
    final String messages[] = { "(You won't find any help here)", "(Nobody can help you)",
            "(Keep on lookin' if you need help)", "(Heeeeelp!)", "(You might want to try google for help)",
            "(Try yelling loudly if you need help)" };

    final Random generator = new Random(System.currentTimeMillis());

    final JMenuItem noHelpItem = new JMenuItem(messages[generator.nextInt(messages.length)]);
    noHelpItem.setEnabled(false);/*from   www  .  java  2s .c  om*/
    helpMenu.add(noHelpItem);

    return helpMenu;
}

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

/**
 * Cria o menu editar do Frame Principal
 * //from   ww  w.j  a  va  2  s  .  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:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java

private JMenu getServerMenu() {
    final JMenu serverMenu = new JMenu("Servers");
    serverMenu.setMnemonic(KeyEvent.VK_S);

    final JMenuItem startServerItem = new JMenuItem("Start new server", Utils.icon("add16.png"));
    startServerItem.setMnemonic(KeyEvent.VK_S);
    startServerItem.addActionListener(new ActionListener() {
        @Override/*from  w ww  .  ja v  a2 s .com*/
        public void actionPerformed(final ActionEvent e) {
            startAddServerWizard();
        }
    });
    serverMenu.add(startServerItem);

    final JMenuItem searchServerItem = new JMenuItem("Filter servers", Utils.icon("search16.png"));
    searchServerItem.setMnemonic(KeyEvent.VK_F);
    searchServerItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            showFilter();
        }
    });
    serverMenu.add(searchServerItem);
    return serverMenu;
}

From source file:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java

private JMenu getProviderMenu() {
    final JMenu providerMenu = new JMenu("Providers");
    providerMenu.setMnemonic(KeyEvent.VK_P);
    providerMenu.getAccessibleContext().setAccessibleDescription("Managing cloud providers.");

    final JMenuItem manageProvidersItem = new JMenuItem("Manage Providers");
    manageProvidersItem.setMnemonic(KeyEvent.VK_M);
    manageProvidersItem.addActionListener(new ActionListener() {
        @Override// ww w.  ja  v a 2  s .  co m
        public void actionPerformed(final ActionEvent e) {
            new ManageProvidersWindow(GUI.this);
        }
    });

    providerMenu.add(manageProvidersItem);

    final JMenuItem detectAllUnlinkedInstances = new JMenuItem("Link/Unlink Instances");
    detectAllUnlinkedInstances.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            new LinkUnlinkWindow(GUI.this);
            // detectAllUnlinkedInstances();
        }
    });
    providerMenu.add(detectAllUnlinkedInstances);
    return providerMenu;
}

From source file:org.ash.gui.MainFrame.java

/**
 * Creates the menu bar.//w w w .  ja v a 2s  .  c  om
 * 
 * @return the j menu bar
 */
private JMenuBar createMenuBar() {
    JMenu menuFile = new JMenu();

    menuFile.setMnemonic(Options.getInstance().getResource("file.mnemonic").charAt(0));
    menuFile.setText(Options.getInstance().getResource("file.text"));
    menuFileExit.setMnemonic(Options.getInstance().getResource("exit.mnemonic").charAt(0));
    menuFileExit.setText(Options.getInstance().getResource("exit.text"));
    menuFileExit.addActionListener(new MainFrame_menuFileExit_ActionAdapter(this));

    menuFile.add(menuFileExit);

    JMenu menuHelp = new JMenu();
    menuHelp.setMnemonic(Options.getInstance().getResource("help.mnemonic").charAt(0));
    menuHelp.setText(Options.getInstance().getResource("help.text"));
    menuHelpAbout.setMnemonic(Options.getInstance().getResource("about.mnemonic").charAt(0));
    menuHelpAbout.setText(Options.getInstance().getResource("about.text"));
    menuHelpAbout.addActionListener(new MainFrame_menuHelpAbout_ActionAdapter(this));

    menuHelp.add(menuHelpAbout);

    JMenuBar bar = new JMenuBar();

    bar.add(menuFile);
    bar.add(menuHelp);

    return bar;
}