Example usage for javax.swing JMenuBar JMenuBar

List of usage examples for javax.swing JMenuBar JMenuBar

Introduction

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

Prototype

public JMenuBar() 

Source Link

Document

Creates a new menu bar.

Usage

From source file:com.net2plan.gui.GUINet2Plan.java

private void start() {
    setExtendedState(JFrame.MAXIMIZED_BOTH);
    setMinimumSize(new Dimension(800, 600));

    itemObject = new DualHashBidiMap<JMenuItem, Object>();

    URL iconURL = GUINet2Plan.class.getResource("/resources/gui/icon.png");
    ImageIcon icon = new ImageIcon(iconURL);
    setIconImage(icon.getImage());//w w w. j  a  v a 2s  . c  o  m
    setTitle("Net2Plan");
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(CLOSE_NET2PLAN);

    getContentPane().setLayout(new MigLayout("insets 0 0 0 0", "[grow]", "[grow]"));
    container = new JPanel(new MigLayout("", "[]", "[]"));
    container.setBorder(new LineBorder(Color.BLACK));
    container.setLayout(new MigLayout("fill"));
    getContentPane().add(container, "grow");

    /* Create menu bar */
    menu = new JMenuBar();
    setJMenuBar(menu);

    /* File menu */
    JMenu file = new JMenu("File");
    file.setMnemonic('F');
    menu.add(file);

    optionsItem = new JMenuItem("Options");
    optionsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.ALT_DOWN_MASK));
    optionsItem.addActionListener(this);
    file.add(optionsItem);

    classPathEditorItem = new JMenuItem("Classpath editor");
    classPathEditorItem.addActionListener(this);
    file.add(classPathEditorItem);

    errorConsoleItem = new JMenuItem("Show Java console");
    errorConsoleItem.addActionListener(this);
    errorConsoleItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, InputEvent.ALT_DOWN_MASK));
    file.add(errorConsoleItem);

    exitItem = new JMenuItem("Exit");
    exitItem.addActionListener(this);
    exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_DOWN_MASK));
    file.add(exitItem);

    /* Help menu */
    JMenu help = new JMenu("Help");
    help.setMnemonic('H');
    menu.add(help);

    aboutItem = new JMenuItem("About");
    aboutItem.addActionListener(this);
    help.add(aboutItem);
    itemObject.put(aboutItem, showAbout());

    helpItem = new JMenuItem("User's guide");
    helpItem.addActionListener(this);
    helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, KeyEvent.VK_UNDEFINED));
    help.add(helpItem);

    javadocItem = new JMenuItem("Library API Javadoc");
    javadocItem.addActionListener(this);
    help.add(javadocItem);

    javadocExamplesItem = new JMenuItem("Built-in Examples Javadoc");
    javadocExamplesItem.addActionListener(this);
    help.add(javadocExamplesItem);

    keyCombinationItem = new JMenuItem("Show tool key combinations");
    keyCombinationItem.addActionListener(this);
    keyCombinationItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, KeyEvent.ALT_DOWN_MASK));
    help.add(keyCombinationItem);

    usedKeyStrokes = new LinkedHashSet<KeyStroke>();
    refreshMenu();

    container.add(showAbout(), "align center");
    container.revalidate();

    new JFileChooser(); /* Do not remove! It is used to avoid slow JFileChooser first-time loading once Net2Plan is shown to the user */

    setVisible(true);
}

From source file:org.angnysa.yaba.swing.BudgetFrame.java

private void buildMenubar() {
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu(Messages.getString("menu.file.label")); //$NON-NLS-1$
    JMenuItem item;// w w  w.  j  ava 2  s.com

    // new
    item = new JMenuItem(Messages.getString("menu.file.new")); //$NON-NLS-1$
    item.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SwingMain.newEditor(null);
        }
    });
    fileMenu.add(item);

    // open
    item = new JMenuItem(Messages.getString("menu.file.open")); //$NON-NLS-1$
    item.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SwingMain.open(id);
        }
    });
    fileMenu.add(item);

    // save
    item = new JMenuItem(Messages.getString("menu.file.save")); //$NON-NLS-1$
    item.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SwingMain.save(id);
        }
    });
    fileMenu.add(item);

    // save as
    item = new JMenuItem(Messages.getString("menu.file.save-as")); //$NON-NLS-1$
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SwingMain.saveas(id);
        }
    });
    fileMenu.add(item);

    // close
    item = new JMenuItem(Messages.getString("menu.file.close")); //$NON-NLS-1$
    item.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SwingMain.close(id);
        }
    });
    fileMenu.add(item);

    menuBar.add(fileMenu);
    setJMenuBar(menuBar);
}

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

/**
 * Cria o menu//w  ww. jav  a 2  s.  c o 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:erigo.filepump.FilePump.java

public JMenuBar createMenu() {
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("File");
    menuBar.add(menu);/* ww  w.  j  a v  a  2s.  c  om*/
    JMenuItem menuItem = new JMenuItem("Settings...");
    menu.add(menuItem);
    menuItem.addActionListener(this);
    menuItem = new JMenuItem("Exit");
    menu.add(menuItem);
    menuItem.addActionListener(this);
    return menuBar;
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstSwing.CFAstSwingMainJFrame.java

public JMenuBar getMainMenuBar() {
    if (mainMenuBar == null) {
        JMenuItem menuItem;/*from ww  w  .j  a v  a 2 s .c om*/
        mainMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        menuFind = new JMenu("Find");
        actionFindAuditAction = new ActionFindAuditAction();
        menuItem = new JMenuItem(actionFindAuditAction);
        menuFind.add(menuItem);
        actionFindCluster = new ActionFindCluster();
        menuItem = new JMenuItem(actionFindCluster);
        menuFind.add(menuItem);
        actionFindHostNode = new ActionFindHostNode();
        menuItem = new JMenuItem(actionFindHostNode);
        menuFind.add(menuItem);
        actionFindISOCountry = new ActionFindISOCountry();
        menuItem = new JMenuItem(actionFindISOCountry);
        menuFind.add(menuItem);
        actionFindISOCurrency = new ActionFindISOCurrency();
        menuItem = new JMenuItem(actionFindISOCurrency);
        menuFind.add(menuItem);
        actionFindISOLanguage = new ActionFindISOLanguage();
        menuItem = new JMenuItem(actionFindISOLanguage);
        menuFind.add(menuItem);
        actionFindISOTimezone = new ActionFindISOTimezone();
        menuItem = new JMenuItem(actionFindISOTimezone);
        menuFind.add(menuItem);
        actionFindMimeType = new ActionFindMimeType();
        menuItem = new JMenuItem(actionFindMimeType);
        menuFind.add(menuItem);
        actionFindSecApp = new ActionFindSecApp();
        menuItem = new JMenuItem(actionFindSecApp);
        menuFind.add(menuItem);
        actionFindSecGroup = new ActionFindSecGroup();
        menuItem = new JMenuItem(actionFindSecGroup);
        menuFind.add(menuItem);
        actionFindSecUser = new ActionFindSecUser();
        menuItem = new JMenuItem(actionFindSecUser);
        menuFind.add(menuItem);
        actionFindServiceType = new ActionFindServiceType();
        menuItem = new JMenuItem(actionFindServiceType);
        menuFind.add(menuItem);
        actionFindTSecGroup = new ActionFindTSecGroup();
        menuItem = new JMenuItem(actionFindTSecGroup);
        menuFind.add(menuItem);
        actionFindTenant = new ActionFindTenant();
        menuItem = new JMenuItem(actionFindTenant);
        menuFind.add(menuItem);
        actionFindTld = new ActionFindTld();
        menuItem = new JMenuItem(actionFindTld);
        menuFind.add(menuItem);
        actionFindURLProtocol = new ActionFindURLProtocol();
        menuItem = new JMenuItem(actionFindURLProtocol);
        menuFind.add(menuItem);
        menuFile.add(menuFind);
        actionFileLogin = new ActionFileLogin();
        menuItem = new JMenuItem(actionFileLogin);
        menuFile.add(menuItem);
        actionFileLogout = new ActionFileLogout();
        menuItem = new JMenuItem(actionFileLogout);
        menuFile.add(menuItem);
        actionFileExit = new ActionFileExit();
        menuItem = new JMenuItem(actionFileExit);
        menuFile.add(menuItem);
        mainMenuBar.add(menuFile);
    }
    return (mainMenuBar);
}

From source file:burlov.ultracipher.swing.SwingGuiApplication.java

private JMenuBar createMenuBar() {
    JMenuBar bar = new JMenuBar();
    JMenu menu = null;/* ww w .j a v a 2s  . c om*/
    /*
     * 'File' Menue
     */
    menu = new JMenu("File");
    menu.setMnemonic(KeyEvent.VK_F);
    bar.add(menu);

    JMenuItem item = new JMenuItem("Save database");
    item.setAccelerator(KeyStroke.getKeyStroke("control S"));
    item.setMnemonic(KeyEvent.VK_S);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            saveDatabase();
        }
    });
    menu.add(item);

    item = new JMenuItem("Download database");
    item.setMnemonic(KeyEvent.VK_L);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            downloadAndMergeData();
        }
    });
    menu.add(item);

    item = new JMenuItem("Edit sync account");
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            editSyncAccount();
        }
    });
    menu.add(item);
    menu.add(new JSeparator());

    JMenu submenu = new JMenu("Import");
    menu.add(submenu);

    item = new JMenuItem("From CSV");
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            importCSV();
        }
    });
    submenu.add(item);

    submenu = new JMenu("Export");
    menu.add(submenu);

    item = new JMenuItem("As CSV");
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            exportCSV();
        }
    });
    submenu.add(item);
    item = new JMenuItem("Change passphrase");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            changePassword();
        }
    });

    /*
     * 'Edit' Menue
     */
    menu = new JMenu("Edit");
    menu.setMnemonic(KeyEvent.VK_E);
    bar.add(menu);
    item = menu.add(mainPanel.getNewEntryAction());
    item.setMnemonic(KeyEvent.VK_N);
    item = menu.add(mainPanel.getDeleteEntryAction());
    item.setMnemonic(KeyEvent.VK_D);

    menu.add(new JSeparator());

    menu = new JMenu("Tools");
    // item = new JMenuItem("Passwort generator");
    // menu.add(item);
    // item.addActionListener(new ActionListener() {
    //
    // @Override
    // public void actionPerformed(ActionEvent e) {
    // passGenerator.setVisible(false);
    // passGenerator.setLocationRelativeTo(getMainFrame());
    // passGenerator.setVisible(true);
    // }
    // });
    item = new JMenuItem("Screen keyboard");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            screenKeyboard.setLocationRelativeTo(getMainFrame());
            screenKeyboard.setVisible(true);

        }
    });
    item = new JMenuItem("File digester");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            digester.setLocationRelativeTo(getMainFrame());
            digester.setVisible(true);

        }
    });
    bar.add(menu);
    /*
     * 'Help' Menue
     */
    menu = new JMenu("Help");
    menu.setMnemonic(KeyEvent.VK_H);
    bar.add(menu);

    item = new JMenuItem("Performance test");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            measurePerformance();
        }
    });
    item = new JMenuItem("System info");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            showSystemInfo();
        }
    });
    item = new JMenuItem("About");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            String text = "<html>Ultracipher 6.1<br>(C) Copyright 2015 Paul Burlov<br><br>"
                    + "Encryption strength: 768Bit (6 x 128Bit keys)<br>Cipher cascade: AES/Twofish/Serpent/CAST6/SEED/Camellia"
                    + "<br>Encryption mode: Two pass CBC"
                    + "<br>Key derivation algorithm: SCrypt with N=2^14,P=8,R=1<br><br> "
                    + "This product includes software developed by the<br>"
                    + "<ul><li>Apache Software Foundation "
                    + "<a href='http://www.apache.org'>http://www.apache.org</a>"
                    + "<li>Legion of the Bouncy Castle <a href='http://bouncycastle.org/'>http://bouncycastle.org</a>"
                    + "<li>Project SwingX" + "<li>Bytecode Pty Ltd." + "</ul></html>";
            JOptionPane.showMessageDialog(getMainFrame(), text, "", JOptionPane.INFORMATION_MESSAGE,
                    getAppIcon());
        }
    });
    bar.add(Box.createHorizontalGlue());
    menu = new JMenu("Keyboard");
    ButtonGroup group = new ButtonGroup();
    JRadioButtonMenuItem radioitem = new JRadioButtonMenuItem("System");
    radioitem.setSelected(true);
    group.add(radioitem);
    radioitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            translator.resetMapping();
        }
    });
    menu.add(radioitem);
    radioitem = new JRadioButtonMenuItem("Futhark runes");
    group.add(radioitem);
    radioitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            translator.initForFuthark();
        }
    });
    menu.add(radioitem);
    radioitem = new JRadioButtonMenuItem("Anglo-Saxon runes");
    group.add(radioitem);
    radioitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            translator.initForAngloSaxon();
        }
    });
    menu.add(radioitem);
    bar.add(menu);
    // bar.add(Box.createHorizontalGlue());
    // bar.add(new PassGeneratorPanel());
    return bar;
}

From source file:com.stonelion.zooviewer.ui.JZVNodePanel.java

private JDialog createAddChildDialog() {
    final JDialog dlg = new JDialog();
    dlg.setModal(true);//from   w  w  w.j  a va2s . c  om

    // Content
    final JPanel content = new JPanel();
    content.setLayout(new BorderLayout());
    content.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    // child name
    AlignmentGridPanel pathPanel = new AlignmentGridPanel();

    final JTextField childNameText = new JTextField();
    final RSyntaxTextArea childDataArea = new RSyntaxTextArea();

    final JMenuBar bar = new JMenuBar();
    final JMenu menu = new JMenu("Syntax Highlight");
    bar.add(menu);

    setMenuItem(menu, childDataArea, SyntaxConstants.SYNTAX_STYLE_XML);
    setMenuItem(menu, childDataArea, SyntaxConstants.SYNTAX_STYLE_JAVA);
    setMenuItem(menu, childDataArea, SyntaxConstants.SYNTAX_STYLE_PROPERTIES_FILE);

    pathPanel.addLine(new Component[] { new JLabel("Select:"), bar });
    pathPanel.addLine(new Component[] { new JLabel("Name: "), childNameText });
    pathPanel.addLine(new Component[] { new JLabel("Data: ") });

    content.add(pathPanel, BorderLayout.NORTH);
    content.add(new RTextScrollPane(childDataArea), BorderLayout.CENTER);

    childDataArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PROPERTIES_FILE);
    // Buttons.
    final CButtonPane btnPanel = new CButtonPane(CButtonPane.TAIL);
    final JButton btnOk = new JButton("Ok");
    btnOk.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String name = childNameText.getText();
            String data = childDataArea.getText();

            if ((name == null || name.isEmpty()) || (data == null || data.isEmpty())) {
                JOptionPane.showMessageDialog(null, "Name or Data is empty", "Error",
                        JOptionPane.ERROR_MESSAGE);
                return;
            }
            childName = name;
            childText = data;
            dlg.setVisible(false);
            dlg.dispose();
        }
    });

    final JButton btnCancel = new JButton("Cancel");
    btnCancel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            childName = "";
            childText = "";
            dlg.setVisible(false);
            dlg.dispose();
        }
    });
    btnPanel.add(btnCancel);
    btnPanel.add(btnOk);
    btnPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    Container con = dlg.getContentPane();
    con.setLayout(new BorderLayout());

    con.add(content, BorderLayout.CENTER);
    con.add(btnPanel, BorderLayout.SOUTH);

    return dlg;
}

From source file:org.jax.maanova.madata.gui.ArrayScatterPlotPanel.java

@SuppressWarnings("serial")
private JMenuBar createMenu() {
    JMenuBar menuBar = new JMenuBar();

    // the file menu
    JMenu fileMenu = new JMenu("File");
    fileMenu.add(this.saveGraphImageAction);
    menuBar.add(fileMenu);/*from ww w .ja  v a  2  s  .co m*/

    // the tools menu
    JMenu toolsMenu = new JMenu("Tools");
    JMenuItem configureGraphItem = new JMenuItem("Configure Graph...");
    configureGraphItem.addActionListener(new ActionListener() {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            ArrayScatterPlotPanel.this.chartConfigurationDialog.setVisible(true);
        }
    });
    toolsMenu.add(configureGraphItem);
    toolsMenu.addSeparator();

    toolsMenu.add(new AbstractAction("Zoom Out") {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            ArrayScatterPlotPanel.this.autoRangeChart();
        }
    });

    JCheckBoxMenuItem showTooltipCheckbox = new JCheckBoxMenuItem("Show Info Popup for Nearest Point");
    showTooltipCheckbox.setSelected(true);
    this.showTooltip = true;
    showTooltipCheckbox.addItemListener(new ItemListener() {
        /**
         * {@inheritDoc}
         */
        public void itemStateChanged(ItemEvent e) {
            ArrayScatterPlotPanel.this.showTooltip = e.getStateChange() == ItemEvent.SELECTED;
            ArrayScatterPlotPanel.this.clearProbePopup();
        }
    });
    toolsMenu.add(showTooltipCheckbox);
    menuBar.add(toolsMenu);

    // the help menu
    JMenu helpMenu = new JMenu("Help");
    JMenuItem helpMenuItem = new JMenuItem("Help...");
    Icon helpIcon = new ImageIcon(ArrayScatterPlotPanel.class.getResource("/images/action/help-16x16.png"));
    helpMenuItem.setIcon(helpIcon);
    helpMenuItem.addActionListener(new ActionListener() {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            Maanova.getInstance().showHelp("array-scatter-plot", ArrayScatterPlotPanel.this);
        }
    });
    helpMenu.add(helpMenuItem);
    menuBar.add(helpMenu);

    return menuBar;
}

From source file:com.mgmtp.perfload.loadprofiles.ui.AppFrame.java

/**
 * Mostly created by Eclipse WindowBuilder
 *//* w w w  . jav a  2s .c om*/
private void initComponents() {
    setTitle("perfLoad - Load Profile Configurator");
    setSize(1032, 984);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    SwingUtils.setUIFontStyle(Font.PLAIN);
    {
        JMenuBar menuBar = new JMenuBar();
        menuBar.setName("menuBar");
        setJMenuBar(menuBar);
        initMenuBar(menuBar);
    }

    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new MigLayout("insets 0", "[grow][]", "[25px][400][grow]"));
    {
        JToolBar toolBar = new JToolBar() {
            @Override
            protected JButton createActionComponent(final Action a) {
                JButton button = super.createActionComponent(a);
                button.setFocusable(false);
                button.setHideActionText(false);
                return button;
            }
        };
        toolBar.setName("toolBar");
        contentPane.add(toolBar, "cell 0 0 2 1,growx,aligny top");
        initToolBar(toolBar);
    }
    {
        JScrollPane spTree = new JScrollPane();
        spTree.setBorder(new CompoundBorder(
                new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Load Profile Elements",
                        TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)),
                new EmptyBorder(4, 4, 4, 4)));
        contentPane.add(spTree, "cell 0 1,grow");
        spTree.setName("spTree");
        {
            tree = new JTree();
            tree.addKeyListener(new TreeKeyListener());
            tree.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
            tree.addTreeSelectionListener(new TreeTreeSelectionListener());
            tree.setShowsRootHandles(true);
            tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
            tree.setName("tree");
            spTree.setViewportView(tree);
        }
    }
    {
        JPanel pnlMain = new JPanel();
        contentPane.add(pnlMain, "cell 1 1");
        pnlMain.setName("pnlMain");
        pnlMain.setLayout(new MigLayout("insets 0", "[664!]", "[grow][]"));
        {
            JPanel pnlLoadProfileProperties = new JPanel();
            pnlLoadProfileProperties.setBorder(new TitledBorder(null, "Load Profile Properties",
                    TitledBorder.LEADING, TitledBorder.TOP, null, null));
            pnlLoadProfileProperties.setName("pnlLoadProfileProperties");
            pnlMain.add(pnlLoadProfileProperties, "flowx,cell 0 0,grow");
            pnlLoadProfileProperties
                    .setLayout(new MigLayout("insets 4", "[270,grow]8[]8[200]8[]8[200]", "[][][][grow]"));
            {
                lblName = new JLabel("Name");
                lblName.setDisplayedMnemonic('N');
                lblName.setHorizontalAlignment(SwingConstants.CENTER);
                lblName.setName("lblName");
                pnlLoadProfileProperties.add(lblName, "cell 0 0");
            }
            {
                JSeparator separator = new JSeparator();
                separator.setPreferredSize(new Dimension(0, 200));
                separator.setOrientation(SwingConstants.VERTICAL);
                separator.setName("separator");
                pnlLoadProfileProperties.add(separator, "cell 1 0 1 4, growy");
            }
            {
                JLabel lblClient = new JLabel("Clients");
                lblClient.setName("lblClient");
                pnlLoadProfileProperties.add(lblClient, "cell 2 0");
            }
            {
                JSeparator separator = new JSeparator();
                separator.setPreferredSize(new Dimension(0, 200));
                separator.setOrientation(SwingConstants.VERTICAL);
                separator.setName("separator");
                pnlLoadProfileProperties.add(separator, "cell 3 0 1 4, growy");
            }
            {
                lblTargets = new JLabel("Targets");
                lblTargets.setName("lblTargets");
                pnlLoadProfileProperties.add(lblTargets, "cell 4 0");
            }
            {
                txtName = new JTextField();
                lblName.setLabelFor(txtName);
                txtName.setColumns(10);
                txtName.setName("txtName");
                txtName.getDocument().addDocumentListener(dirtyListener);
                pnlLoadProfileProperties.add(txtName, "cell 0 1,growx");
            }
            {
                JScrollPane spClients = new JScrollPane();
                spClients.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spClients.setName("spClients");
                pnlLoadProfileProperties.add(spClients, "cell 2 1 1 3,grow");
                {
                    tblClients = new JCheckListTable();
                    tblClients.setName("tblClients");
                    spClients.setViewportView(tblClients);
                    spClients.setColumnHeaderView(null);
                }
            }
            {
                JScrollPane spTargets = new JScrollPane();
                spTargets.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spTargets.setName("spTargets");
                pnlLoadProfileProperties.add(spTargets, "cell 4 1 1 3,grow");
                {
                    tblTargets = new JCheckListTable();
                    tblTargets.setName("tblTargets");
                    spTargets.setViewportView(tblTargets);
                    spTargets.setColumnHeaderView(null);
                }
            }
            {
                lblDescription = new JLabel("Description");
                lblDescription.setDisplayedMnemonic('D');
                lblDescription.setName("lblDescription");
                pnlLoadProfileProperties.add(lblDescription, "cell 0 2");
            }
            {
                JScrollPane spDescription = new JScrollPane();
                spDescription.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                spDescription.setName("spDescription");
                pnlLoadProfileProperties.add(spDescription, "cell 0 3,height 50:50:,grow");
                {
                    taDescription = new JTextArea();
                    taDescription.setFont(txtName.getFont());
                    lblDescription.setLabelFor(taDescription);
                    taDescription.setRows(3);
                    taDescription.setName("taDescription");
                    taDescription.getDocument().addDocumentListener(dirtyListener);
                    spDescription.setViewportView(taDescription);
                }
            }
        }
        {
            JPanel pnlCurveAssignment = new JPanel();
            pnlCurveAssignment.setBorder(new TitledBorder(null, "Active Load Curve Assignment",
                    TitledBorder.LEADING, TitledBorder.TOP, null, null));
            pnlMain.add(pnlCurveAssignment, "cell 0 1,grow");
            pnlCurveAssignment.setLayout(new MigLayout("insets 4", "[grow]", "[grow][]"));
            {
                pnlCard = new JPanel();
                pnlCard.setName("pnlCard");
                pnlCurveAssignment.add(pnlCard, "cell 0 0,grow");
                cardLayout = new CardLayout(0, 0);
                pnlCard.setLayout(cardLayout);
                {
                    stairsPanel = new StairsPanel();
                    stairsPanel.setName("stairsPanel");
                    pnlCard.add(stairsPanel, "stairs");
                }
                {
                    oneTimePanel = new OneTimePanel();
                    oneTimePanel.setName("oneTimePanel");
                    pnlCard.add(oneTimePanel, "oneTime");
                }
                {
                    markerPanel = new MarkerPanel();
                    markerPanel.setName("markerPanel");
                    pnlCard.add(markerPanel, "marker");
                }
                {
                    JLabel lblNoActiveCurve = new JLabel("no active curve assignment");
                    lblNoActiveCurve.setHorizontalAlignment(SwingConstants.CENTER);
                    pnlCard.add(lblNoActiveCurve, "none");
                    lblNoActiveCurve.setName("lblNoActiveCurve");
                }
            }
            {
                btnOk = new JButtonExt("OK");
                getRootPane().setDefaultButton(btnOk);
                btnOk.setEnabled(false);
                btnOk.addActionListener(new BtnOkActionListener());
                btnOk.setMnemonic(KeyEvent.VK_O);
                btnOk.setName("btnOk");
                pnlCurveAssignment.add(btnOk, "cell 0 1,alignx right");
            }
            {
                btnCancel = new JButtonExt("Cancel");
                btnCancel.setEnabled(false);
                btnCancel.addActionListener(new BtnCancelActionListener());
                btnCancel.setMnemonic(KeyEvent.VK_C);
                btnCancel.setName("btnCancel");
                pnlCurveAssignment.add(btnCancel, "cell 0 1,alignx right");
            }
        }
    }
}

From source file:net.sourceforge.msscodefactory.cffreeswitch.v2_1.CFFswSwing.CFFswSwingMainJFrame.java

public JMenuBar getMainMenuBar() {
    if (mainMenuBar == null) {
        JMenuItem menuItem;//  w  ww .j a  va 2 s  .  co  m
        mainMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        menuFind = new JMenu("Find");
        actionFindAuditAction = new ActionFindAuditAction();
        menuItem = new JMenuItem(actionFindAuditAction);
        menuFind.add(menuItem);
        actionFindCluster = new ActionFindCluster();
        menuItem = new JMenuItem(actionFindCluster);
        menuFind.add(menuItem);
        actionFindFSSofia = new ActionFindFSSofia();
        menuItem = new JMenuItem(actionFindFSSofia);
        menuFind.add(menuItem);
        actionFindHostNode = new ActionFindHostNode();
        menuItem = new JMenuItem(actionFindHostNode);
        menuFind.add(menuItem);
        actionFindISOCountry = new ActionFindISOCountry();
        menuItem = new JMenuItem(actionFindISOCountry);
        menuFind.add(menuItem);
        actionFindISOCurrency = new ActionFindISOCurrency();
        menuItem = new JMenuItem(actionFindISOCurrency);
        menuFind.add(menuItem);
        actionFindISOLanguage = new ActionFindISOLanguage();
        menuItem = new JMenuItem(actionFindISOLanguage);
        menuFind.add(menuItem);
        actionFindISOTimezone = new ActionFindISOTimezone();
        menuItem = new JMenuItem(actionFindISOTimezone);
        menuFind.add(menuItem);
        actionFindMimeType = new ActionFindMimeType();
        menuItem = new JMenuItem(actionFindMimeType);
        menuFind.add(menuItem);
        actionFindPbxIvrMenu = new ActionFindPbxIvrMenu();
        menuItem = new JMenuItem(actionFindPbxIvrMenu);
        menuFind.add(menuItem);
        actionFindSecApp = new ActionFindSecApp();
        menuItem = new JMenuItem(actionFindSecApp);
        menuFind.add(menuItem);
        actionFindSecGroup = new ActionFindSecGroup();
        menuItem = new JMenuItem(actionFindSecGroup);
        menuFind.add(menuItem);
        actionFindSecUser = new ActionFindSecUser();
        menuItem = new JMenuItem(actionFindSecUser);
        menuFind.add(menuItem);
        actionFindServiceType = new ActionFindServiceType();
        menuItem = new JMenuItem(actionFindServiceType);
        menuFind.add(menuItem);
        actionFindTSecGroup = new ActionFindTSecGroup();
        menuItem = new JMenuItem(actionFindTSecGroup);
        menuFind.add(menuItem);
        actionFindTenant = new ActionFindTenant();
        menuItem = new JMenuItem(actionFindTenant);
        menuFind.add(menuItem);
        actionFindTld = new ActionFindTld();
        menuItem = new JMenuItem(actionFindTld);
        menuFind.add(menuItem);
        actionFindURLProtocol = new ActionFindURLProtocol();
        menuItem = new JMenuItem(actionFindURLProtocol);
        menuFind.add(menuItem);
        menuFile.add(menuFind);
        actionFileLogin = new ActionFileLogin();
        menuItem = new JMenuItem(actionFileLogin);
        menuFile.add(menuItem);
        actionFileLogout = new ActionFileLogout();
        menuItem = new JMenuItem(actionFileLogout);
        menuFile.add(menuItem);
        actionFileExit = new ActionFileExit();
        menuItem = new JMenuItem(actionFileExit);
        menuFile.add(menuItem);
        mainMenuBar.add(menuFile);
    }
    return (mainMenuBar);
}