Example usage for java.awt.event KeyEvent VK_O

List of usage examples for java.awt.event KeyEvent VK_O

Introduction

In this page you can find the example usage for java.awt.event KeyEvent VK_O.

Prototype

int VK_O

To view the source code for java.awt.event KeyEvent VK_O.

Click Source Link

Document

Constant for the "O" key.

Usage

From source file:com.net2plan.gui.tools.GUINetworkDesign.java

private void addAllKeyCombinationActions() {
    addKeyCombinationAction("Resets the tool", new AbstractAction() {
        @Override/*from   w  ww  .  j  a v a 2  s . c  o m*/
        public void actionPerformed(ActionEvent e) {
            resetButton();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK));

    addKeyCombinationAction("Outputs current design to console", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println(getDesign().toString());
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_F11, InputEvent.CTRL_DOWN_MASK));

    /* FROM THE OFFLINE ALGORITHM EXECUTION */

    addKeyCombinationAction("Execute algorithm", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            executionPane.doClickInExecutionButton();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_E, KeyEvent.CTRL_DOWN_MASK));

    /* From the TOPOLOGY PANEL */
    addKeyCombinationAction("Load design", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            topologyPanel.loadDesign();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK));

    addKeyCombinationAction("Save design", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            topologyPanel.saveDesign();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK));

    addKeyCombinationAction("Zoom in", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (topologyPanel.getSize().getWidth() != 0 && topologyPanel.getSize().getHeight() != 0)
                topologyPanel.getCanvas().zoomIn();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_ADD, InputEvent.CTRL_DOWN_MASK),
            KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, InputEvent.CTRL_DOWN_MASK));

    addKeyCombinationAction("Zoom out", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (topologyPanel.getSize().getWidth() != 0 && topologyPanel.getSize().getHeight() != 0)
                topologyPanel.getCanvas().zoomOut();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, InputEvent.CTRL_DOWN_MASK),
            KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_DOWN_MASK));

    addKeyCombinationAction("Zoom all", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (topologyPanel.getSize().getWidth() != 0 && topologyPanel.getSize().getHeight() != 0)
                topologyPanel.getCanvas().zoomAll();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_MULTIPLY, InputEvent.CTRL_DOWN_MASK));

    addKeyCombinationAction("Take snapshot", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            topologyPanel.takeSnapshot();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_F12, InputEvent.CTRL_DOWN_MASK));

    addKeyCombinationAction("Load traffic demands", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            topologyPanel.loadTrafficDemands();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_DOWN_MASK));

    /* FROM REPORT */
    addKeyCombinationAction("Close selected report", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            int tab = reportPane.getReportContainer().getSelectedIndex();
            if (tab == -1)
                return;
            reportPane.getReportContainer().remove(tab);
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK));

    addKeyCombinationAction("Close all reports", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            reportPane.getReportContainer().removeAll();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));

    /* Online simulation */
    addKeyCombinationAction("Run simulation", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                if (onlineSimulationPane.isRunButtonEnabled())
                    onlineSimulationPane.runSimulation(false);
            } catch (Net2PlanException ex) {
                if (ErrorHandling.isDebugEnabled())
                    ErrorHandling.addErrorOrException(ex, OnlineSimulationPane.class);
                ErrorHandling.showErrorDialog(ex.getMessage(), "Error executing simulation");
            } catch (Throwable ex) {
                ErrorHandling.addErrorOrException(ex, OnlineSimulationPane.class);
                ErrorHandling.showErrorDialog("An error happened");
            }

        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK));

    // Windows
    addKeyCombinationAction("Show control window", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            WindowController.showTablesWindow(true);
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK + ActionEvent.SHIFT_MASK));

    viewEditTopTables.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW,
            this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW));
    viewEditTopTables.setActionMap(this.getActionMap());

    reportPane.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW,
            this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW));
    reportPane.setActionMap(this.getActionMap());

    executionPane.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW,
            this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW));
    executionPane.setActionMap(this.getActionMap());

    onlineSimulationPane.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW,
            this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW));
    onlineSimulationPane.setActionMap(this.getActionMap());

    whatIfAnalysisPane.setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW,
            this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW));
    whatIfAnalysisPane.setActionMap(this.getActionMap());
}

From source file:mondrian.gui.Workbench.java

/**
 * This method is called from within the constructor to
 * initialize the form./* w w  w . j  av a2  s  . c  om*/
 */
private void initComponents() {
    desktopPane = new javax.swing.JDesktopPane();
    jToolBar1 = new javax.swing.JToolBar();
    jToolBar2 = new javax.swing.JToolBar();
    toolbarNewPopupMenu = new JPopupMenu();
    toolbarNewButton = new javax.swing.JButton();
    toolbarOpenButton = new javax.swing.JButton();
    toolbarSaveButton = new javax.swing.JButton();
    toolbarSaveAsButton = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    toolbarPreferencesButton = new javax.swing.JButton();
    requireSchemaCheckboxMenuItem = new javax.swing.JCheckBoxMenuItem();
    menuBar = new javax.swing.JMenuBar();
    fileMenu = new javax.swing.JMenu();
    newMenu = new javax.swing.JMenu();
    newSchemaMenuItem = new javax.swing.JMenuItem();
    newQueryMenuItem = new javax.swing.JMenuItem();
    newJDBCExplorerMenuItem = new javax.swing.JMenuItem();
    newSchemaMenuItem2 = new javax.swing.JMenuItem();
    newQueryMenuItem2 = new javax.swing.JMenuItem();
    newJDBCExplorerMenuItem2 = new javax.swing.JMenuItem();
    openMenuItem = new javax.swing.JMenuItem();
    preferencesMenuItem = new javax.swing.JMenuItem();
    lastUsed1MenuItem = new javax.swing.JMenuItem();
    lastUsed2MenuItem = new javax.swing.JMenuItem();
    lastUsed3MenuItem = new javax.swing.JMenuItem();
    lastUsed4MenuItem = new javax.swing.JMenuItem();
    saveMenuItem = new javax.swing.JMenuItem();
    saveAsMenuItem = new javax.swing.JMenuItem();
    jSeparator1 = new javax.swing.JSeparator();
    jSeparator2 = new javax.swing.JSeparator();
    jSeparator3 = new javax.swing.JSeparator();
    exitMenuItem = new javax.swing.JMenuItem();
    windowMenu = new javax.swing.JMenu();
    helpMenu = new javax.swing.JMenu();
    editMenu = new javax.swing.JMenu();
    cutMenuItem = new javax.swing.JMenuItem(new DefaultEditorKit.CutAction());
    copyMenuItem = new javax.swing.JMenuItem(new DefaultEditorKit.CopyAction());
    pasteMenuItem = new javax.swing.JMenuItem(new DefaultEditorKit.PasteAction());
    deleteMenuItem = new javax.swing.JMenuItem(
            new AbstractAction(getResourceConverter().getString("workbench.menu.delete", "Delete")) {
                private static final long serialVersionUID = 1L;

                public void actionPerformed(ActionEvent e) {
                    JInternalFrame jf = desktopPane.getSelectedFrame();
                    if (jf != null && jf.getContentPane().getComponent(0) instanceof SchemaExplorer) {
                        SchemaExplorer se = (SchemaExplorer) jf.getContentPane().getComponent(0);
                        TreePath tpath = se.tree.getSelectionPath();
                        se.delete(tpath);
                    }
                }
            });
    aboutMenuItem = new javax.swing.JMenuItem();
    toolsMenu = new javax.swing.JMenu();
    viewMenu = new javax.swing.JMenu();
    viewXmlMenuItem = new javax.swing.JCheckBoxMenuItem();

    setTitle(getResourceConverter().getString("workbench.panel.title", "Schema Workbench"));
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent evt) {
            storeWorkbenchProperties();
            storeDatabaseMeta();
            closeAllSchemaFrames(true);
        }
    });

    getContentPane().add(desktopPane, java.awt.BorderLayout.CENTER);

    newSchemaMenuItem2.setText(getResourceConverter().getString("workbench.menu.newSchema", "Schema"));
    newSchemaMenuItem2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newSchemaMenuItemActionPerformed(evt);
        }
    });

    newQueryMenuItem2.setText(getResourceConverter().getString("workbench.menu.newQuery", "MDX Query"));
    newQueryMenuItem2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newQueryMenuItemActionPerformed(evt);
        }
    });

    newJDBCExplorerMenuItem2
            .setText(getResourceConverter().getString("workbench.menu.newJDBC", "JDBC Explorer"));
    newJDBCExplorerMenuItem2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newJDBCExplorerMenuItemActionPerformed(evt);
        }
    });

    toolbarNewPopupMenu.add(newSchemaMenuItem2);
    toolbarNewPopupMenu.add(newQueryMenuItem2);
    toolbarNewPopupMenu.add(newJDBCExplorerMenuItem2);

    jPanel2.setLayout(new java.awt.BorderLayout());
    jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    jPanel2.setMaximumSize(new java.awt.Dimension(50, 28));

    toolbarNewButton.setIcon(
            new javax.swing.ImageIcon(getClass().getResource(getResourceConverter().getGUIReference("new"))));
    toolbarNewButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.new", "New"));
    toolbarNewButton.setBorderPainted(false);
    toolbarNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            toolbarNewPopupMenu.show(jPanel2, 0, jPanel2.getSize().height);
        }
    });

    jToolBar2.setFloatable(false);
    jToolBar2.add(toolbarNewButton);

    jPanel2.add(jToolBar2, java.awt.BorderLayout.CENTER);

    toolbarNewArrowButton = new BasicArrowButton(SwingConstants.SOUTH);
    toolbarNewArrowButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.newArrow", "New"));
    toolbarNewArrowButton.setBorderPainted(false);
    toolbarNewArrowButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            toolbarNewPopupMenu.show(jPanel2, 0, jPanel2.getSize().height);
        }
    });

    jPanel2.add(toolbarNewArrowButton, java.awt.BorderLayout.EAST);

    jToolBar1.add(jPanel2, 0);

    toolbarOpenButton.setIcon(
            new javax.swing.ImageIcon(getClass().getResource(getResourceConverter().getGUIReference("open"))));
    toolbarOpenButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.open", "Open"));
    toolbarOpenButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            openMenuItemActionPerformed(evt);
        }
    });

    jToolBar1.add(toolbarOpenButton);

    toolbarSaveButton.setIcon(
            new javax.swing.ImageIcon(getClass().getResource(getResourceConverter().getGUIReference("save"))));
    toolbarSaveButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.save", "Save"));
    toolbarSaveButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            saveMenuItemActionPerformed(evt);
        }
    });

    jToolBar1.add(toolbarSaveButton);

    toolbarSaveAsButton.setIcon(new javax.swing.ImageIcon(
            getClass().getResource(getResourceConverter().getGUIReference("saveAs"))));
    toolbarSaveAsButton.setToolTipText(getResourceConverter().getString("workbench.toolbar.saveAs", "Save As"));
    toolbarSaveAsButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            saveAsMenuItemActionPerformed(evt);
        }
    });

    jToolBar1.add(toolbarSaveAsButton);

    jPanel1.setMaximumSize(new java.awt.Dimension(8, 8));
    jToolBar1.add(jPanel1);

    toolbarPreferencesButton.setIcon(new javax.swing.ImageIcon(
            getClass().getResource(getResourceConverter().getGUIReference("preferences"))));
    toolbarPreferencesButton
            .setToolTipText(getResourceConverter().getString("workbench.toolbar.connection", "Connection"));
    toolbarPreferencesButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            connectionButtonActionPerformed(evt);
        }
    });

    jToolBar1.add(toolbarPreferencesButton);

    getContentPane().add(jToolBar1, java.awt.BorderLayout.NORTH);

    fileMenu.setText(getResourceConverter().getString("workbench.menu.file", "File"));
    fileMenu.setMnemonic(KeyEvent.VK_F);
    newMenu.setText(getResourceConverter().getString("workbench.menu.new", "New"));

    newSchemaMenuItem.setText(getResourceConverter().getString("workbench.menu.newSchema", "Schema"));
    newSchemaMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newSchemaMenuItemActionPerformed(evt);
        }
    });

    newMenu.add(newSchemaMenuItem);

    newQueryMenuItem.setText(getResourceConverter().getString("workbench.menu.newQuery", "MDX Query"));
    newQueryMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newQueryMenuItemActionPerformed(evt);
        }
    });

    newMenu.add(newQueryMenuItem);

    newJDBCExplorerMenuItem
            .setText(getResourceConverter().getString("workbench.menu.newJDBC", "JDBC Explorer"));
    newJDBCExplorerMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            newJDBCExplorerMenuItemActionPerformed(evt);
        }
    });

    newMenu.add(newJDBCExplorerMenuItem);

    fileMenu.add(newMenu);

    openMenuItem.setText(getResourceConverter().getString("workbench.menu.open", "Open"));
    openMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            openMenuItemActionPerformed(evt);
        }
    });

    fileMenu.add(openMenuItem);

    saveMenuItem.setText(getResourceConverter().getString("workbench.menu.save", "Save"));
    saveMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            saveMenuItemActionPerformed(evt);
        }
    });

    fileMenu.add(saveMenuItem);

    saveAsMenuItem.setText(getResourceConverter().getString("workbench.menu.saveAsDot", "Save As ..."));
    saveAsMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            saveAsMenuItemActionPerformed(evt);
        }
    });

    fileMenu.add(saveAsMenuItem);

    // add last used
    fileMenu.add(jSeparator2);

    lastUsed1MenuItem.setText(getWorkbenchProperty("lastUsed1"));
    lastUsed1MenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            lastUsed1MenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(lastUsed1MenuItem);

    lastUsed2MenuItem.setText(getWorkbenchProperty("lastUsed2"));
    lastUsed2MenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            lastUsed2MenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(lastUsed2MenuItem);

    lastUsed3MenuItem.setText(getWorkbenchProperty("lastUsed3"));
    lastUsed3MenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            lastUsed3MenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(lastUsed3MenuItem);

    lastUsed4MenuItem.setText(getWorkbenchProperty("lastUsed4"));
    lastUsed4MenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            lastUsed4MenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(lastUsed4MenuItem);

    updateLastUsedMenu();
    fileMenu.add(jSeparator1);

    exitMenuItem.setText(getResourceConverter().getString("workbench.menu.exit", "Exit"));
    exitMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            exitMenuItemActionPerformed(evt);
        }
    });

    fileMenu.add(exitMenuItem);

    menuBar.add(fileMenu);

    editMenu.setText(getResourceConverter().getString("workbench.menu.edit", "Edit"));
    editMenu.setMnemonic(KeyEvent.VK_E);
    cutMenuItem.setText(getResourceConverter().getString("workbench.menu.cut", "Cut"));
    editMenu.add(cutMenuItem);

    copyMenuItem.setText(getResourceConverter().getString("workbench.menu.copy", "Copy"));
    editMenu.add(copyMenuItem);

    pasteMenuItem.setText(getResourceConverter().getString("workbench.menu.paste", "Paste"));
    editMenu.add(pasteMenuItem);

    editMenu.add(deleteMenuItem);

    menuBar.add(editMenu);

    viewMenu.setText(getResourceConverter().getString("workbench.menu.view", "View"));
    viewMenu.setMnemonic(KeyEvent.VK_V);
    viewXmlMenuItem.setText(getResourceConverter().getString("workbench.menu.viewXML", "View XML"));
    viewXmlMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            viewXMLMenuItemActionPerformed(evt);
        }
    });
    viewMenu.add(viewXmlMenuItem);
    menuBar.add(viewMenu);

    toolsMenu.setText(getResourceConverter().getString("workbench.menu.options", "Options"));
    toolsMenu.setMnemonic(KeyEvent.VK_O);
    preferencesMenuItem.setText(getResourceConverter().getString("workbench.menu.connection", "Connection"));
    preferencesMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            connectionButtonActionPerformed(evt);
        }
    });
    toolsMenu.add(preferencesMenuItem);

    requireSchemaCheckboxMenuItem
            .setText(getResourceConverter().getString("workbench.menu.requireSchema", "Require Schema"));
    requireSchemaCheckboxMenuItem.setSelected(requireSchema);
    requireSchemaCheckboxMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            requireSchemaActionPerformed(e);
        }
    });

    toolsMenu.add(requireSchemaCheckboxMenuItem);
    menuBar.add(toolsMenu);

    windowMenu.setText(getResourceConverter().getString("workbench.menu.windows", "Windows"));
    windowMenu.setMnemonic(KeyEvent.VK_W);

    cascadeMenuItem = new javax.swing.JMenuItem();
    cascadeMenuItem
            .setText(getResourceConverter().getString("workbench.menu.cascadeWindows", "Cascade Windows"));
    cascadeMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            cascadeMenuItemActionPerformed(evt);
        }
    });

    tileMenuItem = new javax.swing.JMenuItem();
    tileMenuItem.setText(getResourceConverter().getString("workbench.menu.tileWindows", "Tile Windows"));
    tileMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            tileMenuItemActionPerformed(evt);
        }
    });

    closeAllMenuItem = new javax.swing.JMenuItem();
    closeAllMenuItem.setText(getResourceConverter().getString("workbench.menu.closeAll", "Close All"));
    closeAllMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            closeAllMenuItemActionPerformed(evt);
        }
    });

    minimizeMenuItem = new javax.swing.JMenuItem();
    minimizeMenuItem.setText(getResourceConverter().getString("workbench.menu.minimizeAll", "Minimize All"));
    minimizeMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            minimizeMenuItemActionPerformed(evt);
        }
    });

    maximizeMenuItem = new javax.swing.JMenuItem();
    maximizeMenuItem.setText(getResourceConverter().getString("workbench.menu.maximizeAll", "Maximize All"));
    maximizeMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            maximizeMenuItemActionPerformed(evt);
        }
    });

    menuBar.add(windowMenu);

    aboutMenuItem.setText(getResourceConverter().getString("workbench.menu.about", "About"));
    aboutMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            aboutMenuItemActionPerformed(evt);
        }
    });

    helpMenu.add(aboutMenuItem);

    helpMenu.setText(getResourceConverter().getString("workbench.menu.help", "Help"));
    helpMenu.setMnemonic(KeyEvent.VK_H);
    menuBar.add(helpMenu);

    setJMenuBar(menuBar);

    pack();
}

From source file:net.jradius.client.gui.JRadiusSimulator.java

/**
 * This method initializes jMenuItem// ww  w  . j a v a 2  s  . co m
 * 
 * @return javax.swing.JMenuItem
 */
private JMenuItem getOpenMenuItem() {
    if (openMenuItem == null) {
        openMenuItem = new JMenuItem();
        openMenuItem.setText("Open");
        openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK, true));
        openMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                JFileChooser chooser = new JFileChooser();
                int returnVal = chooser.showOpenDialog(JRadiusSimulator.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = chooser.getSelectedFile();
                    try {
                        loadConfigFile("file:///" + file.getAbsolutePath());
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(null, ex.getMessage(), "Error",
                                JOptionPane.ERROR_MESSAGE);
                        ex.printStackTrace();
                    }
                }
            }
        });
    }
    return openMenuItem;
}

From source file:com._17od.upm.gui.MainWindow.java

private JMenuBar createMenuBar() {

    JMenuBar menuBar = new JMenuBar();

    databaseMenu = new JMenu(Translator.translate("databaseMenu"));
    databaseMenu.setMnemonic(KeyEvent.VK_D);
    menuBar.add(databaseMenu);//from  ww  w  . j  a va  2s  .  com

    newDatabaseMenuItem = new JMenuItem(Translator.translate(NEW_DATABASE_TXT), KeyEvent.VK_N);
    newDatabaseMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    databaseMenu.add(newDatabaseMenuItem);
    newDatabaseMenuItem.addActionListener(this);
    newDatabaseMenuItem.setActionCommand(NEW_DATABASE_TXT);

    openDatabaseMenuItem = new JMenuItem(Translator.translate(OPEN_DATABASE_TXT), KeyEvent.VK_O);
    openDatabaseMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    databaseMenu.add(openDatabaseMenuItem);
    openDatabaseMenuItem.addActionListener(this);
    openDatabaseMenuItem.setActionCommand(OPEN_DATABASE_TXT);

    openDatabaseFromURLMenuItem = new JMenuItem(Translator.translate(OPEN_DATABASE_FROM_URL_TXT),
            KeyEvent.VK_L);
    openDatabaseFromURLMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_L, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    databaseMenu.add(openDatabaseFromURLMenuItem);
    openDatabaseFromURLMenuItem.addActionListener(this);
    openDatabaseFromURLMenuItem.setActionCommand(OPEN_DATABASE_FROM_URL_TXT);

    databaseMenu.addSeparator();

    syncWithRemoteDatabaseMenuItem = new JMenuItem(Translator.translate(SYNC_DATABASE_TXT), KeyEvent.VK_S);
    syncWithRemoteDatabaseMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    databaseMenu.add(syncWithRemoteDatabaseMenuItem);
    syncWithRemoteDatabaseMenuItem.addActionListener(this);
    syncWithRemoteDatabaseMenuItem.setEnabled(false);
    syncWithRemoteDatabaseMenuItem.setActionCommand(SYNC_DATABASE_TXT);

    changeMasterPasswordMenuItem = new JMenuItem(Translator.translate(CHANGE_MASTER_PASSWORD_TXT),
            KeyEvent.VK_G);
    changeMasterPasswordMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_G, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    databaseMenu.add(changeMasterPasswordMenuItem);
    changeMasterPasswordMenuItem.addActionListener(this);
    changeMasterPasswordMenuItem.setEnabled(false);
    changeMasterPasswordMenuItem.setActionCommand(CHANGE_MASTER_PASSWORD_TXT);

    databasePropertiesMenuItem = new JMenuItem(Translator.translate(DATABASE_PROPERTIES_TXT), KeyEvent.VK_I);
    databasePropertiesMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_I, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    databaseMenu.add(databasePropertiesMenuItem);
    databasePropertiesMenuItem.addActionListener(this);
    databasePropertiesMenuItem.setEnabled(false);
    databasePropertiesMenuItem.setActionCommand(DATABASE_PROPERTIES_TXT);

    databaseMenu.addSeparator();

    exportMenuItem = new JMenuItem(Translator.translate(EXPORT_TXT));
    databaseMenu.add(exportMenuItem);
    exportMenuItem.addActionListener(this);
    exportMenuItem.setEnabled(false);
    exportMenuItem.setActionCommand(EXPORT_TXT);

    importMenuItem = new JMenuItem(Translator.translate(IMPORT_TXT));
    databaseMenu.add(importMenuItem);
    importMenuItem.addActionListener(this);
    importMenuItem.setEnabled(false);
    importMenuItem.setActionCommand(IMPORT_TXT);

    accountMenu = new JMenu(Translator.translate("accountMenu"));
    accountMenu.setMnemonic(KeyEvent.VK_A);
    menuBar.add(accountMenu);

    addAccountMenuItem = new JMenuItem(Translator.translate(ADD_ACCOUNT_TXT), KeyEvent.VK_A);
    addAccountMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    accountMenu.add(addAccountMenuItem);
    addAccountMenuItem.addActionListener(this);
    addAccountMenuItem.setEnabled(false);
    addAccountMenuItem.setActionCommand(ADD_ACCOUNT_TXT);

    editAccountMenuItem = new JMenuItem(Translator.translate(EDIT_ACCOUNT_TXT), KeyEvent.VK_E);
    editAccountMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    accountMenu.add(editAccountMenuItem);
    editAccountMenuItem.addActionListener(this);
    editAccountMenuItem.setEnabled(false);
    editAccountMenuItem.setActionCommand(EDIT_ACCOUNT_TXT);

    deleteAccountMenuItem = new JMenuItem(Translator.translate(DELETE_ACCOUNT_TXT), KeyEvent.VK_D);
    deleteAccountMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    accountMenu.add(deleteAccountMenuItem);
    deleteAccountMenuItem.addActionListener(this);
    deleteAccountMenuItem.setEnabled(false);
    deleteAccountMenuItem.setActionCommand(DELETE_ACCOUNT_TXT);

    viewAccountMenuItem = new JMenuItem(Translator.translate(VIEW_ACCOUNT_TXT), KeyEvent.VK_V);
    viewAccountMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    accountMenu.add(viewAccountMenuItem);
    viewAccountMenuItem.addActionListener(this);
    viewAccountMenuItem.setEnabled(false);
    viewAccountMenuItem.setActionCommand(VIEW_ACCOUNT_TXT);

    copyUsernameMenuItem = new JMenuItem(Translator.translate(COPY_USERNAME_TXT), KeyEvent.VK_U);
    copyUsernameMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_U, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    accountMenu.add(copyUsernameMenuItem);
    copyUsernameMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            copyUsernameToClipboard();
        }
    });
    copyUsernameMenuItem.setEnabled(false);
    copyUsernameMenuItem.setActionCommand(COPY_USERNAME_TXT);

    copyPasswordMenuItem = new JMenuItem(Translator.translate(COPY_PASSWORD_TXT), KeyEvent.VK_P);
    copyPasswordMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    accountMenu.add(copyPasswordMenuItem);
    copyPasswordMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            copyPasswordToClipboard();
        }
    });

    copyPasswordMenuItem.setEnabled(false);
    copyPasswordMenuItem.setActionCommand(COPY_PASSWORD_TXT);

    launchURLMenuItem = new JMenuItem(Translator.translate(LAUNCH_URL_TXT), KeyEvent.VK_B);
    launchURLMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_B, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    accountMenu.add(launchURLMenuItem);
    launchURLMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {

            AccountInformation accInfo = dbActions.getSelectedAccount();
            String uRl = accInfo.getUrl();

            // Check if the selected url is null or emty and inform the user
            // via JoptioPane message
            if ((uRl == null) || (uRl.length() == 0)) {
                JOptionPane.showMessageDialog(accountMenu.getParent().getParent(),
                        Translator.translate("EmptyUrlJoptionpaneMsg"),
                        Translator.translate("UrlErrorJoptionpaneTitle"), JOptionPane.WARNING_MESSAGE);

                // Check if the selected url is a valid formated url(via
                // urlIsValid() method) and inform the user via JoptioPane
                // message
            } else if (!(urlIsValid(uRl))) {
                JOptionPane.showMessageDialog(accountMenu.getParent().getParent(),
                        Translator.translate("InvalidUrlJoptionpaneMsg"),
                        Translator.translate("UrlErrorJoptionpaneTitle"), JOptionPane.WARNING_MESSAGE);

                // Call the method LaunchSelectedURL() using the selected
                // url as input
            } else {
                LaunchSelectedURL(uRl);

            }
        }
    });

    launchURLMenuItem.setEnabled(false);
    launchURLMenuItem.setActionCommand(LAUNCH_URL_TXT);

    exitMenuItem = new JMenuItem(Translator.translate(EXIT_TXT), KeyEvent.VK_X);
    exitMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    exitMenuItem.addActionListener(this);
    exitMenuItem.setActionCommand(EXIT_TXT);

    aboutMenuItem = new JMenuItem(Translator.translate(ABOUT_TXT), KeyEvent.VK_A);
    aboutMenuItem.addActionListener(this);
    aboutMenuItem.setActionCommand(ABOUT_TXT);

    // Because the MAC version of UPM will have a program item in the menu
    // bar then these items
    // only need to be added on non-mac platforms
    if (!PlatformSpecificCode.isMAC()) {
        databaseMenu.addSeparator();
        databaseMenu.add(exitMenuItem);

        helpMenu = new JMenu(Translator.translate("helpMenu"));
        helpMenu.setMnemonic(KeyEvent.VK_H);
        menuBar.add(helpMenu);

        helpMenu.add(aboutMenuItem);
    }

    return menuBar;

}

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

/**
 * Mostly created by Eclipse WindowBuilder
 *//*from w  w w. j a  va2s .c o m*/
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:com.igormaznitsa.jhexed.swing.editor.ui.MainForm.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor./*from  w ww  .j  av  a  2s.c o  m*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    panelMainArea = new javax.swing.JPanel();
    jPanel1 = new javax.swing.JPanel();
    labelCellUnderMouse = new javax.swing.JLabel();
    labelZoomStatus = new javax.swing.JLabel();
    menuMain = new javax.swing.JMenuBar();
    menuFile = new javax.swing.JMenu();
    menuFileNew = new javax.swing.JMenuItem();
    menuItemFileOpen = new javax.swing.JMenuItem();
    menuFileSave = new javax.swing.JMenuItem();
    menuFileSaveAs = new javax.swing.JMenuItem();
    jSeparator1 = new javax.swing.JPopupMenu.Separator();
    menuFileExportAs = new javax.swing.JMenu();
    menuFileExportAsImage = new javax.swing.JMenuItem();
    menuFileExportAsSVG = new javax.swing.JMenuItem();
    menuFileExportAsXML = new javax.swing.JMenuItem();
    menuFileExportAsJavaConstants = new javax.swing.JMenuItem();
    jSeparator3 = new javax.swing.JPopupMenu.Separator();
    menuFileDocumentOptions = new javax.swing.JMenuItem();
    jSeparator4 = new javax.swing.JPopupMenu.Separator();
    menuFileExit = new javax.swing.JMenuItem();
    menuEdit = new javax.swing.JMenu();
    menuEditUndo = new javax.swing.JMenuItem();
    menuEditRedo = new javax.swing.JMenuItem();
    menuView = new javax.swing.JMenu();
    menuViewZoomIn = new javax.swing.JMenuItem();
    menuViewZoomOut = new javax.swing.JMenuItem();
    menuViewZoomReset = new javax.swing.JMenuItem();
    jSeparator2 = new javax.swing.JPopupMenu.Separator();
    menuViewBackImage = new javax.swing.JCheckBoxMenuItem();
    menuShowHexBorders = new javax.swing.JCheckBoxMenuItem();
    menuPlugins = new javax.swing.JMenu();
    menuWindow = new javax.swing.JMenu();
    menuWindowLayers = new javax.swing.JCheckBoxMenuItem();
    menuWindowTools = new javax.swing.JCheckBoxMenuItem();
    menuWindowOptions = new javax.swing.JCheckBoxMenuItem();
    menuLANDF = new javax.swing.JMenu();
    menuHelp = new javax.swing.JMenu();
    menuHelpAbout = new javax.swing.JMenuItem();

    setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
    setTitle("JHexed Map editor");
    setLocationByPlatform(true);
    setMinimumSize(new java.awt.Dimension(300, 300));
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
            formWindowClosed(evt);
        }

        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });

    panelMainArea.setLayout(new java.awt.BorderLayout());

    jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

    labelCellUnderMouse.setText("   ");

    labelZoomStatus.setText("   ");

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addComponent(labelCellUnderMouse)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 705, Short.MAX_VALUE)
                    .addComponent(labelZoomStatus).addContainerGap()));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    jPanel1Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                            .addGroup(jPanel1Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(labelCellUnderMouse).addComponent(labelZoomStatus))));

    panelMainArea.add(jPanel1, java.awt.BorderLayout.PAGE_END);

    getContentPane().add(panelMainArea, java.awt.BorderLayout.CENTER);

    menuFile.setText("File");
    menuFile.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileActionPerformed(evt);
        }
    });

    menuFileNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N,
            java.awt.event.InputEvent.CTRL_MASK));
    menuFileNew.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/new.png"))); // NOI18N
    menuFileNew.setText("New");
    menuFileNew.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileNewActionPerformed(evt);
        }
    });
    menuFile.add(menuFileNew);

    menuItemFileOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O,
            java.awt.event.InputEvent.CTRL_MASK));
    menuItemFileOpen.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/folder-open-image.png"))); // NOI18N
    menuItemFileOpen.setText("Open");
    menuItemFileOpen.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuItemFileOpenActionPerformed(evt);
        }
    });
    menuFile.add(menuItemFileOpen);

    menuFileSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            java.awt.event.InputEvent.CTRL_MASK));
    menuFileSave.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/drive-download.png"))); // NOI18N
    menuFileSave.setText("Save");
    menuFileSave.setEnabled(false);
    menuFileSave.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileSaveActionPerformed(evt);
        }
    });
    menuFile.add(menuFileSave);

    menuFileSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    menuFileSaveAs.setText("Save As...");
    menuFileSaveAs.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileSaveAsActionPerformed(evt);
        }
    });
    menuFile.add(menuFileSaveAs);
    menuFile.add(jSeparator1);

    menuFileExportAs.setText("Export as...");

    menuFileExportAsImage.setText("PNG Image");
    menuFileExportAsImage.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileExportAsImageActionPerformed(evt);
        }
    });
    menuFileExportAs.add(menuFileExportAsImage);

    menuFileExportAsSVG.setText("SVG Image");
    menuFileExportAsSVG.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileExportAsSVGActionPerformed(evt);
        }
    });
    menuFileExportAs.add(menuFileExportAsSVG);

    menuFileExportAsXML.setText("Xml file");
    menuFileExportAsXML.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileExportAsXMLActionPerformed(evt);
        }
    });
    menuFileExportAs.add(menuFileExportAsXML);

    menuFileExportAsJavaConstants.setText("Java constants");
    menuFileExportAsJavaConstants.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileExportAsJavaConstantsActionPerformed(evt);
        }
    });
    menuFileExportAs.add(menuFileExportAsJavaConstants);

    menuFile.add(menuFileExportAs);
    menuFile.add(jSeparator3);

    menuFileDocumentOptions.setText("Document options");
    menuFileDocumentOptions.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileDocumentOptionsActionPerformed(evt);
        }
    });
    menuFile.add(menuFileDocumentOptions);
    menuFile.add(jSeparator4);

    menuFileExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4,
            java.awt.event.InputEvent.ALT_MASK));
    menuFileExit.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/door-open-out.png"))); // NOI18N
    menuFileExit.setText("Exit");
    menuFileExit.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileExitActionPerformed(evt);
        }
    });
    menuFile.add(menuFileExit);

    menuMain.add(menuFile);

    menuEdit.setText("Edit");

    menuEditUndo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z,
            java.awt.event.InputEvent.CTRL_MASK));
    menuEditUndo.setText("Undo");
    menuEditUndo.setEnabled(false);
    menuEditUndo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuEditUndoActionPerformed(evt);
        }
    });
    menuEdit.add(menuEditUndo);

    menuEditRedo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X,
            java.awt.event.InputEvent.CTRL_MASK));
    menuEditRedo.setText("Redo");
    menuEditRedo.setEnabled(false);
    menuEditRedo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuEditRedoActionPerformed(evt);
        }
    });
    menuEdit.add(menuEditRedo);

    menuMain.add(menuEdit);

    menuView.setText("View");

    menuViewZoomIn.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I,
            java.awt.event.InputEvent.CTRL_MASK));
    menuViewZoomIn.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/magnifier-zoom-in.png"))); // NOI18N
    menuViewZoomIn.setText("Zoom In");
    menuViewZoomIn.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuViewZoomInActionPerformed(evt);
        }
    });
    menuView.add(menuViewZoomIn);

    menuViewZoomOut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    menuViewZoomOut.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/magnifier-zoom-out.png"))); // NOI18N
    menuViewZoomOut.setText("Zoom Out");
    menuViewZoomOut.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuViewZoomOutActionPerformed(evt);
        }
    });
    menuView.add(menuViewZoomOut);

    menuViewZoomReset.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R,
            java.awt.event.InputEvent.CTRL_MASK));
    menuViewZoomReset.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/jhexed/swing/editor/icons/magnifier-zoom-actual.png"))); // NOI18N
    menuViewZoomReset.setText("Zoom Reset");
    menuViewZoomReset.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuViewZoomResetActionPerformed(evt);
        }
    });
    menuView.add(menuViewZoomReset);
    menuView.add(jSeparator2);

    menuViewBackImage.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B,
            java.awt.event.InputEvent.CTRL_MASK));
    menuViewBackImage.setSelected(true);
    menuViewBackImage.setText("Show back image");
    menuViewBackImage.setToolTipText("Show/Hide the background image");
    menuViewBackImage.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            menuViewBackImageStateChanged(evt);
        }
    });
    menuView.add(menuViewBackImage);

    menuShowHexBorders.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_H,
            java.awt.event.InputEvent.CTRL_MASK));
    menuShowHexBorders.setSelected(true);
    menuShowHexBorders.setText("Show hex borders");
    menuShowHexBorders.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            menuShowHexBordersStateChanged(evt);
        }
    });
    menuView.add(menuShowHexBorders);

    menuMain.add(menuView);

    menuPlugins.setText("Plugins");
    menuMain.add(menuPlugins);

    menuWindow.setText("Window");

    menuWindowLayers.setSelected(true);
    menuWindowLayers.setText("Layers");
    menuWindowLayers.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuWindowLayersActionPerformed(evt);
        }
    });
    menuWindow.add(menuWindowLayers);

    menuWindowTools.setSelected(true);
    menuWindowTools.setText("Tools");
    menuWindowTools.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuWindowToolsActionPerformed(evt);
        }
    });
    menuWindow.add(menuWindowTools);

    menuWindowOptions.setSelected(true);
    menuWindowOptions.setText("Options");
    menuWindowOptions.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuWindowOptionsActionPerformed(evt);
        }
    });
    menuWindow.add(menuWindowOptions);

    menuMain.add(menuWindow);

    menuLANDF.setText("Look&Feel");
    menuMain.add(menuLANDF);

    menuHelp.setText("Help");

    menuHelpAbout.setText("About");
    menuHelpAbout.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuHelpAboutActionPerformed(evt);
        }
    });
    menuHelp.add(menuHelpAbout);

    menuMain.add(menuHelp);

    setJMenuBar(menuMain);

    pack();
}

From source file:savant.view.swing.Savant.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor./*from w ww  .  j  a  v  a2 s  .c  o m*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    view_buttongroup = new javax.swing.ButtonGroup();
    toolbar_bottom = new javax.swing.JToolBar();
    label_mouseposition_title = new javax.swing.JLabel();
    mousePositionLabel = new javax.swing.JLabel();
    timeCaption = new javax.swing.JLabel();
    label_status = new javax.swing.JLabel();
    s_e_sep = new javax.swing.JToolBar.Separator();
    label_memory = new javax.swing.JLabel();
    panel_browser = new javax.swing.JPanel();
    panel_top = new javax.swing.JPanel();
    panelExtendedMiddle = new javax.swing.JPanel();
    panel_main = new javax.swing.JPanel();
    pluginToolbar = new javax.swing.JPanel();
    menuBar_top = new javax.swing.JMenuBar();
    fileMenu = new javax.swing.JMenu();
    loadGenomeItem = new javax.swing.JMenuItem();
    loadFromFileItem = new javax.swing.JMenuItem();
    loadFromURLItem = new javax.swing.JMenuItem();
    loadFromDataSourcePluginItem = new javax.swing.JMenuItem();
    recentTrackMenu = new javax.swing.JMenu();
    javax.swing.JPopupMenu.Separator jSeparator1 = new javax.swing.JPopupMenu.Separator();
    openProjectItem = new javax.swing.JMenuItem();
    recentProjectMenu = new javax.swing.JMenu();
    saveProjectItem = new javax.swing.JMenuItem();
    saveProjectAsItem = new javax.swing.JMenuItem();
    javax.swing.JPopupMenu.Separator jSeparator2 = new javax.swing.JPopupMenu.Separator();
    formatItem = new javax.swing.JMenuItem();
    javax.swing.JPopupMenu.Separator jSeparator3 = new javax.swing.JPopupMenu.Separator();
    exportItem = new javax.swing.JMenuItem();
    jSeparator4 = new javax.swing.JPopupMenu.Separator();
    exitItem = new javax.swing.JMenuItem();
    editMenu = new javax.swing.JMenu();
    undoItem = new javax.swing.JMenuItem();
    redoItem = new javax.swing.JMenuItem();
    javax.swing.JPopupMenu.Separator jSeparator6 = new javax.swing.JPopupMenu.Separator();
    bookmarkItem = new javax.swing.JMenuItem();
    deselectAllItem = new javax.swing.JMenuItem();
    jSeparator7 = new javax.swing.JPopupMenu.Separator();
    preferencesItem = new javax.swing.JMenuItem();
    viewMenu = new javax.swing.JMenu();
    panLeftItem = new javax.swing.JMenuItem();
    panRightItem = new javax.swing.JMenuItem();
    zoomInItem = new javax.swing.JMenuItem();
    zoomOutItem = new javax.swing.JMenuItem();
    toStartItem = new javax.swing.JMenuItem();
    toEndItem = new javax.swing.JMenuItem();
    javax.swing.JSeparator jSeparator8 = new javax.swing.JSeparator();
    crosshairItem = new javax.swing.JCheckBoxMenuItem();
    plumblineItem = new javax.swing.JCheckBoxMenuItem();
    spotlightItem = new javax.swing.JCheckBoxMenuItem();
    windowMenu = new javax.swing.JMenu();
    navigationItem = new javax.swing.JCheckBoxMenuItem();
    genomeItem = new javax.swing.JCheckBoxMenuItem();
    rulerItem = new javax.swing.JCheckBoxMenuItem();
    pluginToolbarItem = new javax.swing.JCheckBoxMenuItem();
    statusBarItem = new javax.swing.JCheckBoxMenuItem();
    speedAndEfficiencyItem = new javax.swing.JCheckBoxMenuItem();
    javax.swing.JSeparator jSeparator9 = new javax.swing.JSeparator();
    bookmarksItem = new javax.swing.JCheckBoxMenuItem();
    pluginsMenu = new javax.swing.JMenu();
    menuitem_pluginmanager = new javax.swing.JMenuItem();
    jSeparator10 = new javax.swing.JPopupMenu.Separator();
    helpMenu = new javax.swing.JMenu();
    userManualItem = new javax.swing.JMenuItem();
    tutorialsItem = new javax.swing.JMenuItem();
    javax.swing.JMenuItem checkForUpdatesItem = new javax.swing.JMenuItem();
    javax.swing.JMenuItem bugReportItem = new javax.swing.JMenuItem();
    javax.swing.JMenuItem featureRequestItem = new javax.swing.JMenuItem();
    javax.swing.JSeparator jSeparator11 = new javax.swing.JSeparator();
    websiteItem = new javax.swing.JMenuItem();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setBackground(new java.awt.Color(204, 204, 204));

    toolbar_bottom.setFloatable(false);
    toolbar_bottom.setAlignmentX(1.0F);

    label_mouseposition_title.setText(" Position: ");
    toolbar_bottom.add(label_mouseposition_title);
    toolbar_bottom.add(mousePositionLabel);

    timeCaption.setText("Time: ");
    toolbar_bottom.add(timeCaption);

    label_status.setMaximumSize(new java.awt.Dimension(300, 14));
    label_status.setMinimumSize(new java.awt.Dimension(100, 14));
    label_status.setPreferredSize(new java.awt.Dimension(100, 14));
    toolbar_bottom.add(label_status);
    toolbar_bottom.add(s_e_sep);

    label_memory.setText(" Memory: ");
    toolbar_bottom.add(label_memory);

    panel_top.setMaximumSize(new java.awt.Dimension(1000, 30));
    panel_top.setMinimumSize(new java.awt.Dimension(0, 0));
    panel_top.setPreferredSize(new java.awt.Dimension(0, 30));
    panel_top.setLayout(new java.awt.BorderLayout());

    panelExtendedMiddle.setMinimumSize(new java.awt.Dimension(990, 30));
    panelExtendedMiddle.setPreferredSize(new java.awt.Dimension(990, 30));

    javax.swing.GroupLayout panelExtendedMiddleLayout = new javax.swing.GroupLayout(panelExtendedMiddle);
    panelExtendedMiddle.setLayout(panelExtendedMiddleLayout);
    panelExtendedMiddleLayout.setHorizontalGroup(panelExtendedMiddleLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 1045, Short.MAX_VALUE));
    panelExtendedMiddleLayout.setVerticalGroup(panelExtendedMiddleLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 30, Short.MAX_VALUE));

    panel_top.add(panelExtendedMiddle, java.awt.BorderLayout.CENTER);

    panel_main.setBackground(new java.awt.Color(153, 153, 153));
    panel_main.setMaximumSize(new java.awt.Dimension(99999, 99999));
    panel_main.setMinimumSize(new java.awt.Dimension(1, 1));
    panel_main.setPreferredSize(new java.awt.Dimension(99999, 99999));

    javax.swing.GroupLayout panel_mainLayout = new javax.swing.GroupLayout(panel_main);
    panel_main.setLayout(panel_mainLayout);
    panel_mainLayout.setHorizontalGroup(panel_mainLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE));
    panel_mainLayout.setVerticalGroup(panel_mainLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 532, Short.MAX_VALUE));

    pluginToolbar.setVisible(false);
    pluginToolbar.setPreferredSize(new java.awt.Dimension(856, 24));
    pluginToolbar.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEADING));

    javax.swing.GroupLayout panel_browserLayout = new javax.swing.GroupLayout(panel_browser);
    panel_browser.setLayout(panel_browserLayout);
    panel_browserLayout.setHorizontalGroup(
            panel_browserLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(panel_top, javax.swing.GroupLayout.DEFAULT_SIZE, 1045, Short.MAX_VALUE)
                    .addComponent(pluginToolbar, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_main, javax.swing.GroupLayout.DEFAULT_SIZE, 1045, Short.MAX_VALUE));
    panel_browserLayout.setVerticalGroup(panel_browserLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panel_browserLayout.createSequentialGroup().addContainerGap()
                    .addComponent(panel_top, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(pluginToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, 24,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(panel_main, javax.swing.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)));

    fileMenu.setText("File");

    loadGenomeItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G,
            java.awt.event.InputEvent.CTRL_MASK));
    loadGenomeItem.setText("Load Genome...");
    loadGenomeItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            loadGenomeItemActionPerformed(evt);
        }
    });
    fileMenu.add(loadGenomeItem);

    loadFromFileItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T,
            java.awt.event.InputEvent.CTRL_MASK));
    loadFromFileItem.setText("Load Track from File...");
    loadFromFileItem.setEnabled(false);
    loadFromFileItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            loadFromFileItemActionPerformed(evt);
        }
    });
    fileMenu.add(loadFromFileItem);

    loadFromURLItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U,
            java.awt.event.InputEvent.CTRL_MASK));
    loadFromURLItem.setText("Load Track from URL...");
    loadFromURLItem.setEnabled(false);
    loadFromURLItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            loadFromURLItemActionPerformed(evt);
        }
    });
    fileMenu.add(loadFromURLItem);

    loadFromDataSourcePluginItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E,
            java.awt.event.InputEvent.CTRL_MASK));
    loadFromDataSourcePluginItem.setText("Load Track from Repository...");
    loadFromDataSourcePluginItem.setEnabled(false);
    loadFromDataSourcePluginItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            loadFromDataSourcePluginItemActionPerformed(evt);
        }
    });
    fileMenu.add(loadFromDataSourcePluginItem);

    recentTrackMenu.setText("Load Recent Track");
    fileMenu.add(recentTrackMenu);
    fileMenu.add(jSeparator1);

    openProjectItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O,
            java.awt.event.InputEvent.CTRL_MASK));
    openProjectItem.setText("Open Project...");
    openProjectItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            openProjectItemActionPerformed(evt);
        }
    });
    fileMenu.add(openProjectItem);

    recentProjectMenu.setText("Open Recent Project");
    fileMenu.add(recentProjectMenu);

    saveProjectItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            java.awt.event.InputEvent.CTRL_MASK));
    saveProjectItem.setText("Save Project");
    saveProjectItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveProjectItemActionPerformed(evt);
        }
    });
    fileMenu.add(saveProjectItem);

    saveProjectAsItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    saveProjectAsItem.setText("Save Project As...");
    saveProjectAsItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveProjectAsItemActionPerformed(evt);
        }
    });
    fileMenu.add(saveProjectAsItem);
    fileMenu.add(jSeparator2);

    formatItem.setText("Format File...");
    formatItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            formatItemActionPerformed(evt);
        }
    });
    fileMenu.add(formatItem);
    fileMenu.add(jSeparator3);

    exportItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I,
            java.awt.event.InputEvent.CTRL_MASK));
    exportItem.setText("Export Track Images...");
    exportItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuitem_exportActionPerformed(evt);
        }
    });
    fileMenu.add(exportItem);
    fileMenu.add(jSeparator4);

    exitItem.setText("Exit");
    exitItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitItemActionPerformed(evt);
        }
    });
    fileMenu.add(exitItem);

    menuBar_top.add(fileMenu);

    editMenu.setText("Edit");

    undoItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z,
            java.awt.event.InputEvent.CTRL_MASK));
    undoItem.setText("Undo Range Change");
    undoItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            undoItemActionPerformed(evt);
        }
    });
    editMenu.add(undoItem);

    redoItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Y,
            java.awt.event.InputEvent.CTRL_MASK));
    redoItem.setText("Redo Range Change");
    redoItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            redoItemActionPerformed(evt);
        }
    });
    editMenu.add(redoItem);
    editMenu.add(jSeparator6);

    bookmarkItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D,
            java.awt.event.InputEvent.CTRL_MASK));
    bookmarkItem.setText("Bookmark");
    bookmarkItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            bookmarkItemActionPerformed(evt);
        }
    });
    editMenu.add(bookmarkItem);

    deselectAllItem.setText("Deselect All");
    deselectAllItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuitem_deselectActionPerformed(evt);
        }
    });
    editMenu.add(deselectAllItem);
    editMenu.add(jSeparator7);

    preferencesItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P,
            java.awt.event.InputEvent.CTRL_MASK));
    preferencesItem.setText("Preferences");
    preferencesItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            preferencesItemActionPerformed(evt);
        }
    });
    editMenu.add(preferencesItem);

    menuBar_top.add(editMenu);

    viewMenu.setText("View");

    panLeftItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_LEFT,
            java.awt.event.InputEvent.SHIFT_MASK));
    panLeftItem.setText("Pan Left");
    panLeftItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            panLeftItemActionPerformed(evt);
        }
    });
    viewMenu.add(panLeftItem);

    panRightItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_RIGHT,
            java.awt.event.InputEvent.SHIFT_MASK));
    panRightItem.setText("Pan Right");
    panRightItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            panRightItemActionPerformed(evt);
        }
    });
    viewMenu.add(panRightItem);

    zoomInItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_UP,
            java.awt.event.InputEvent.SHIFT_MASK));
    zoomInItem.setText("Zoom In");
    zoomInItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            zoomInItemActionPerformed(evt);
        }
    });
    viewMenu.add(zoomInItem);

    zoomOutItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DOWN,
            java.awt.event.InputEvent.SHIFT_MASK));
    zoomOutItem.setText("Zoom Out");
    zoomOutItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            zoomOutItemActionPerformed(evt);
        }
    });
    viewMenu.add(zoomOutItem);

    toStartItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_HOME, 0));
    toStartItem.setText("Shift to Start");
    toStartItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            toStartItemActionPerformed(evt);
        }
    });
    viewMenu.add(toStartItem);

    toEndItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_END, 0));
    toEndItem.setText("Shift to End");
    toEndItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            toEndItemActionPerformed(evt);
        }
    });
    viewMenu.add(toEndItem);
    viewMenu.add(jSeparator8);

    crosshairItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_J,
            java.awt.event.InputEvent.CTRL_MASK));
    crosshairItem.setText("Crosshair");
    crosshairItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            crosshairItemActionPerformed(evt);
        }
    });
    viewMenu.add(crosshairItem);

    plumblineItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_K,
            java.awt.event.InputEvent.CTRL_MASK));
    plumblineItem.setText("Plumbline");
    plumblineItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            plumblineItemActionPerformed(evt);
        }
    });
    viewMenu.add(plumblineItem);

    spotlightItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L,
            java.awt.event.InputEvent.CTRL_MASK));
    spotlightItem.setText("Spotlight");
    spotlightItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            spotlightItemActionPerformed(evt);
        }
    });
    viewMenu.add(spotlightItem);

    menuBar_top.add(viewMenu);

    windowMenu.setText("Window");
    windowMenu.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            windowMenuStateChanged(evt);
        }
    });

    navigationItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    navigationItem.setText("Navigation");
    navigationItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            navigationItemMousePressed(evt);
        }
    });
    windowMenu.add(navigationItem);

    genomeItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    genomeItem.setText("Genome");
    genomeItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            genomeItemActionPerformed(evt);
        }
    });
    windowMenu.add(genomeItem);

    rulerItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    rulerItem.setText("Ruler");
    rulerItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            rulerItemActionPerformed(evt);
        }
    });
    windowMenu.add(rulerItem);

    pluginToolbarItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    pluginToolbarItem.setSelected(true);
    pluginToolbarItem.setText("Plugin Toolbar");
    pluginToolbarItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            pluginToolbarItemActionPerformed(evt);
        }
    });
    windowMenu.add(pluginToolbarItem);

    statusBarItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    statusBarItem.setSelected(true);
    statusBarItem.setText("Status Bar");
    statusBarItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            statusBarItemActionPerformed(evt);
        }
    });
    windowMenu.add(statusBarItem);

    speedAndEfficiencyItem.setText("Resources");
    speedAndEfficiencyItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            speedAndEfficiencyItemActionPerformed(evt);
        }
    });
    windowMenu.add(speedAndEfficiencyItem);
    windowMenu.add(jSeparator9);

    bookmarksItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    bookmarksItem.setText("Bookmarks");
    bookmarksItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            bookmarksItemActionPerformed(evt);
        }
    });
    windowMenu.add(bookmarksItem);

    menuBar_top.add(windowMenu);

    pluginsMenu.setText("Plugins");

    menuitem_pluginmanager.setText("Plugin Manager");
    menuitem_pluginmanager.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuitem_pluginmanagerActionPerformed(evt);
        }
    });
    pluginsMenu.add(menuitem_pluginmanager);
    pluginsMenu.add(jSeparator10);

    menuBar_top.add(pluginsMenu);

    helpMenu.setText("Help");

    userManualItem.setText("Manuals");
    userManualItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            userManualItemActionPerformed(evt);
        }
    });
    helpMenu.add(userManualItem);

    tutorialsItem.setText("Video Tutorials");
    tutorialsItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            tutorialsItemActionPerformed(evt);
        }
    });
    helpMenu.add(tutorialsItem);

    checkForUpdatesItem.setText("Check for updates");
    checkForUpdatesItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            checkForUpdatesItemActionPerformed(evt);
        }
    });
    helpMenu.add(checkForUpdatesItem);

    bugReportItem.setText("Report an issue");
    bugReportItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            bugReportItemActionPerformed(evt);
        }
    });
    helpMenu.add(bugReportItem);

    featureRequestItem.setText("Request a feature");
    featureRequestItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            featureRequestItemActionPerformed(evt);
        }
    });
    helpMenu.add(featureRequestItem);
    helpMenu.add(jSeparator11);

    websiteItem.setText("Website");
    websiteItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            websiteItemActionPerformed(evt);
        }
    });
    helpMenu.add(websiteItem);

    menuBar_top.add(helpMenu);

    setJMenuBar(menuBar_top);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panel_browser, javax.swing.GroupLayout.PREFERRED_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(toolbar_bottom, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addComponent(panel_browser, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(toolbar_bottom, javax.swing.GroupLayout.PREFERRED_SIZE, 25,
                            javax.swing.GroupLayout.PREFERRED_SIZE)));

    pack();
}

From source file:com.adobe.aem.demomachine.gui.AemDemo.java

@SuppressWarnings({ "rawtypes", "unchecked" })
private void initialize() {

    // Initialize properties
    setDefaultProperties(AemDemoUtils/*ww  w  . j a va2s .  co  m*/
            .loadProperties(buildFile.getParentFile().getAbsolutePath() + File.separator + "build.properties"));
    setPersonalProperties(AemDemoUtils.loadProperties(buildFile.getParentFile().getAbsolutePath()
            + File.separator + "conf" + File.separator + "build-personal.properties"));

    // Constructing the main frame
    frameMain = new JFrame();
    frameMain.setBounds(100, 100, 700, 530);
    frameMain.getContentPane().setLayout(null);

    // Main menu bar for the Frame
    JMenuBar menuBar = new JMenuBar();

    JMenu mnAbout = new JMenu("AEM Demo Machine");
    mnAbout.setMnemonic(KeyEvent.VK_A);
    menuBar.add(mnAbout);

    JMenuItem mntmUpdates = new JMenuItem("Check for Updates");
    mntmUpdates.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmUpdates.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "demo_update");
        }
    });
    mnAbout.add(mntmUpdates);

    JMenuItem mntmDoc = new JMenuItem("Help and Documentation");
    mntmDoc.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_H, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmDoc.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties,
                    AemDemoConstants.OPTIONS_DOCUMENTATION));
        }
    });
    mnAbout.add(mntmDoc);

    JMenuItem mntmScripts = new JMenuItem("Demo Scripts (VPN)");
    mntmScripts.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties,
                    AemDemoConstants.OPTIONS_SCRIPTS));
        }
    });
    mnAbout.add(mntmScripts);

    JMenuItem mntmDiagnostics = new JMenuItem("Diagnostics");
    mntmDiagnostics.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Map<String, String> env = System.getenv();
            System.out.println("====== System Environment Variables ======");
            for (String envName : env.keySet()) {
                System.out.format("%s=%s%n", envName, env.get(envName));
            }
            System.out.println("====== JVM Properties ======");
            RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
            List<String> jvmArgs = runtimeMXBean.getInputArguments();
            for (String arg : jvmArgs) {
                System.out.println(arg);
            }
            System.out.println("====== Runtime Properties ======");
            Properties props = System.getProperties();
            props.list(System.out);
        }
    });
    mnAbout.add(mntmDiagnostics);

    JMenuItem mntmQuit = new JMenuItem("Quit");
    mntmQuit.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmQuit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(-1);
        }
    });
    mnAbout.add(mntmQuit);

    JMenu mnNew = new JMenu("New");
    menuBar.add(mnNew);

    // New Demo Machine
    JMenuItem mntmNewDemo = new JMenuItem("Demo Environment");
    mntmNewDemo.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmNewDemo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            if (AemDemo.this.getBuildInProgress()) {

                JOptionPane.showMessageDialog(null,
                        "A Demo Environment is currently being built. Please wait until it is finished.");

            } else {

                final AemDemoNew dialogNew = new AemDemoNew(AemDemo.this);
                dialogNew.setModal(true);
                dialogNew.setVisible(true);
                dialogNew.getDemoBuildName().requestFocus();
                ;

            }
        }
    });
    mnNew.add(mntmNewDemo);

    JMenuItem mntmNewOptions = new JMenuItem("Demo Properties");
    mntmNewOptions.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmNewOptions.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            final AemDemoOptions dialogOptions = new AemDemoOptions(AemDemo.this);
            dialogOptions.setModal(true);
            dialogOptions.setVisible(true);

        }
    });
    mnNew.add(mntmNewOptions);

    JMenu mnUpdate = new JMenu("Add-ons");
    menuBar.add(mnUpdate);

    // Sites Add-on
    JMenu mnSites = new JMenu("Sites");
    mnUpdate.add(mnSites);

    JMenuItem mntmSitesDownloadAddOn = new JMenuItem("Download Demo Add-on");
    mntmSitesDownloadAddOn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_sites");
        }
    });
    mnSites.add(mntmSitesDownloadAddOn);

    JMenuItem mntmSitesDownloadFP = new JMenuItem("Download Packages (PackageShare)");
    mntmSitesDownloadFP.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_sites_packages");
        }
    });
    mnSites.add(mntmSitesDownloadFP);

    // Assets Add-on
    JMenu mnAssets = new JMenu("Assets");
    mnUpdate.add(mnAssets);

    JMenuItem mntmAssetsDownloadAddOn = new JMenuItem("Download Demo Add-on");
    mntmAssetsDownloadAddOn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_assets");
        }
    });
    mnAssets.add(mntmAssetsDownloadAddOn);

    JMenuItem mntmAssetsDownloadFP = new JMenuItem("Download Packages (PackageShare)");
    mntmAssetsDownloadFP.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_assets_packages");
        }
    });
    mnAssets.add(mntmAssetsDownloadFP);

    // Communities Add-on
    JMenu mnCommunities = new JMenu("Communities/Livefyre");
    mnUpdate.add(mnCommunities);

    JMenuItem mntmAemCommunitiesFeaturePacks = new JMenuItem("Download Packages (PackageShare)");
    mntmAemCommunitiesFeaturePacks.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_communities_packages");
        }
    });
    mnCommunities.add(mntmAemCommunitiesFeaturePacks);

    // Forms Add-on
    JMenu mnForms = new JMenu("Forms");
    mnUpdate.add(mnForms);

    JMenuItem mntmAemFormsAddon = new JMenuItem("Download Demo Add-on");
    mntmAemFormsAddon.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_forms");
        }
    });
    mnForms.add(mntmAemFormsAddon);

    JMenuItem mntmAemFormsFP = new JMenuItem("Download Packages (PackageShare)");
    mntmAemFormsFP.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_forms_packages");
        }
    });
    mnForms.add(mntmAemFormsFP);

    // Mobile Add-on
    JMenu mnApps = new JMenu("Mobile");
    mnUpdate.add(mnApps);

    JMenuItem mntmAemAppsAddon = new JMenuItem("Download Demo Add-on");
    mntmAemAppsAddon.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_apps");
        }
    });
    mnApps.add(mntmAemAppsAddon);

    JMenuItem mntmAemApps = new JMenuItem("Download Packages (PackageShare)");
    mntmAemApps.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_apps_packages");
        }
    });
    mnApps.add(mntmAemApps);

    // Commerce Add-on
    JMenu mnCommerce = new JMenu("Commerce");
    mnUpdate.add(mnCommerce);

    JMenu mnCommerceDownload = new JMenu("Download Packages");
    mnCommerce.add(mnCommerceDownload);

    // Commerce EP
    JMenuItem mnCommerceDownloadEP = new JMenuItem("ElasticPath (PackageShare)");
    mnCommerceDownloadEP.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_commerce_ep");
        }
    });
    mnCommerceDownload.add(mnCommerceDownloadEP);

    // Commerce WebSphere
    JMenuItem mnCommerceDownloadWAS = new JMenuItem("WebSphere (PackageShare)");
    mnCommerceDownloadWAS.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_commerce_websphere");
        }
    });
    mnCommerceDownload.add(mnCommerceDownloadWAS);

    // WeRetail Add-on
    JMenu mnWeRetail = new JMenu("We-Retail");
    mnUpdate.add(mnWeRetail);

    JMenuItem mnWeRetailAddon = new JMenuItem("Download Demo Add-on");
    mnWeRetailAddon.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_weretail");
        }
    });
    mnWeRetail.add(mnWeRetailAddon);

    // Download all section
    mnUpdate.addSeparator();

    JMenuItem mntmAemDownloadAll = new JMenuItem("Download All Add-ons");
    mntmAemDownloadAll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_all");
        }
    });
    mnUpdate.add(mntmAemDownloadAll);

    JMenu mnInfrastructure = new JMenu("Infrastructure");
    menuBar.add(mnInfrastructure);

    JMenu mnMongo = new JMenu("MongoDB");

    JMenuItem mntmInfraMongoDB = new JMenuItem("Download");
    mntmInfraMongoDB.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_mongo");
        }
    });
    mnMongo.add(mntmInfraMongoDB);

    JMenuItem mntmInfraMongoDBInstall = new JMenuItem("Install");
    mntmInfraMongoDBInstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "install_mongo");
        }
    });
    mnMongo.add(mntmInfraMongoDBInstall);
    mnMongo.addSeparator();

    JMenuItem mntmInfraMongoDBStart = new JMenuItem("Start");
    mntmInfraMongoDBStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "mongo_start");
        }
    });
    mnMongo.add(mntmInfraMongoDBStart);

    JMenuItem mntmInfraMongoDBStop = new JMenuItem("Stop");
    mntmInfraMongoDBStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "mongo_stop");
        }
    });
    mnMongo.add(mntmInfraMongoDBStop);
    mnInfrastructure.add(mnMongo);

    // SOLR options
    JMenu mnSOLR = new JMenu("SOLR");

    JMenuItem mntmInfraSOLR = new JMenuItem("Download");
    mntmInfraSOLR.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_solr");
        }
    });
    mnSOLR.add(mntmInfraSOLR);

    JMenuItem mntmInfraSOLRInstall = new JMenuItem("Install");
    mntmInfraSOLRInstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "install_solr");
        }
    });
    mnSOLR.add(mntmInfraSOLRInstall);
    mnSOLR.addSeparator();

    JMenuItem mntmInfraSOLRStart = new JMenuItem("Start");
    mntmInfraSOLRStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "solr_start");
        }
    });
    mnSOLR.add(mntmInfraSOLRStart);

    JMenuItem mntmInfraSOLRStop = new JMenuItem("Stop");
    mntmInfraSOLRStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "solr_stop");
        }
    });
    mnSOLR.add(mntmInfraSOLRStop);

    mnInfrastructure.add(mnSOLR);

    // MySQL options
    JMenu mnMySQL = new JMenu("MySQL");

    JMenuItem mntmInfraMysql = new JMenuItem("Download");
    mntmInfraMysql.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_mysql");
        }
    });
    mnMySQL.add(mntmInfraMysql);

    JMenuItem mntmInfraMysqlInstall = new JMenuItem("Install");
    mntmInfraMysqlInstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "install_mysql");
        }
    });
    mnMySQL.add(mntmInfraMysqlInstall);

    mnMySQL.addSeparator();

    JMenuItem mntmInfraMysqlStart = new JMenuItem("Start");
    mntmInfraMysqlStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "mysql_start");
        }
    });
    mnMySQL.add(mntmInfraMysqlStart);

    JMenuItem mntmInfraMysqlStop = new JMenuItem("Stop");
    mntmInfraMysqlStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "mysql_stop");
        }
    });
    mnMySQL.add(mntmInfraMysqlStop);

    mnInfrastructure.add(mnMySQL);

    // James options
    JMenu mnJames = new JMenu("James SMTP/POP");

    JMenuItem mntmInfraJames = new JMenuItem("Download");
    mntmInfraJames.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_james");
        }
    });
    mnJames.add(mntmInfraJames);

    JMenuItem mntmInfraJamesInstall = new JMenuItem("Install");
    mntmInfraJamesInstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "install_james");
        }
    });
    mnJames.add(mntmInfraJamesInstall);
    mnJames.addSeparator();

    JMenuItem mntmInfraJamesStart = new JMenuItem("Start");
    mntmInfraJamesStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "james_start");
        }
    });
    mnJames.add(mntmInfraJamesStart);

    JMenuItem mntmInfraJamesStop = new JMenuItem("Stop");
    mntmInfraJamesStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "james_stop");
        }
    });
    mnJames.add(mntmInfraJamesStop);

    mnInfrastructure.add(mnJames);

    // FFMPEPG options
    JMenu mnFFMPEG = new JMenu("FFMPEG");

    JMenuItem mntmInfraFFMPEG = new JMenuItem("Download");
    mntmInfraFFMPEG.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_ffmpeg");
        }
    });
    mnFFMPEG.add(mntmInfraFFMPEG);

    JMenuItem mntmInfraFFMPEGInstall = new JMenuItem("Install");
    mntmInfraFFMPEGInstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "install_ffmpeg");
        }
    });
    mnFFMPEG.add(mntmInfraFFMPEGInstall);

    mnInfrastructure.add(mnFFMPEG);

    mnInfrastructure.addSeparator();

    // InDesignServer options
    JMenu mnInDesignServer = new JMenu("InDesign Server");

    JMenuItem mntmInfraInDesignServerDownload = new JMenuItem("Download");
    mntmInfraInDesignServerDownload.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_indesignserver");
        }
    });
    mnInDesignServer.add(mntmInfraInDesignServerDownload);

    mnInDesignServer.addSeparator();

    JMenuItem mntmInfraInDesignServerStart = new JMenuItem("Start");
    mntmInfraInDesignServerStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "start_indesignserver");
        }
    });
    mnInDesignServer.add(mntmInfraInDesignServerStart);

    JMenuItem mntmInfraInDesignServerStop = new JMenuItem("Stop");
    mntmInfraInDesignServerStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "stop_indesignserver");
        }
    });
    mnInDesignServer.add(mntmInfraInDesignServerStop);

    mnInfrastructure.add(mnInDesignServer);

    mnInfrastructure.addSeparator();

    JMenuItem mntmInfraInstall = new JMenuItem("All in One Setup");
    mntmInfraInstall.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "infrastructure");
        }
    });
    mnInfrastructure.add(mntmInfraInstall);

    JMenu mnOther = new JMenu("Other");
    menuBar.add(mnOther);

    JMenu mntmAemDownload = new JMenu("AEM & License files (VPN)");

    JMenuItem mntmAemLoad = new JMenuItem("Download Latest AEM Load");
    mntmAemLoad.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_L, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmAemLoad.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_load");
        }
    });
    mntmAemDownload.add(mntmAemLoad);

    JMenuItem mntmAemSnapshot = new JMenuItem("Download Latest AEM Snapshot");
    mntmAemSnapshot.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_T, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmAemSnapshot.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_snapshot");
        }
    });
    mntmAemDownload.add(mntmAemSnapshot);

    JMenuItem mntmAemDownloadAEM62 = new JMenuItem("Download AEM 6.2");
    mntmAemDownloadAEM62.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_aem62");
        }
    });
    mntmAemDownload.add(mntmAemDownloadAEM62);

    JMenuItem mntmAemDownloadAEM61 = new JMenuItem("Download AEM 6.1");
    mntmAemDownloadAEM61.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_aem61");
        }
    });
    mntmAemDownload.add(mntmAemDownloadAEM61);

    JMenuItem mntmAemDownloadAEM60 = new JMenuItem("Download AEM 6.0");
    mntmAemDownloadAEM60.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_aem60");
        }
    });
    mntmAemDownload.add(mntmAemDownloadAEM60);

    JMenuItem mntmAemDownloadCQ561 = new JMenuItem("Download CQ 5.6.1");
    mntmAemDownloadCQ561.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_cq561");
        }
    });
    mntmAemDownload.add(mntmAemDownloadCQ561);

    JMenuItem mntmAemDownloadCQ56 = new JMenuItem("Download CQ 5.6");
    mntmAemDownloadCQ56.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_cq56");
        }
    });
    mntmAemDownload.add(mntmAemDownloadCQ56);

    JMenuItem mntmAemDownloadOthers = new JMenuItem("Other Releases & License files");
    mntmAemDownloadOthers.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.openWebpage(AemDemoUtils.getActualPropertyValue(defaultProperties, personalProperties,
                    AemDemoConstants.OPTIONS_DOWNLOAD));
        }
    });
    mntmAemDownload.add(mntmAemDownloadOthers);

    mnOther.add(mntmAemDownload);

    JMenuItem mntmAemHotfix = new JMenuItem("Download Latest Hotfixes (PackageShare)");
    mntmAemHotfix.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_F, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmAemHotfix.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_hotfixes_packages");
        }
    });
    mnOther.add(mntmAemHotfix);

    JMenuItem mntmAemAcs = new JMenuItem("Download Latest ACS Commons and Tools");
    mntmAemAcs.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    mntmAemAcs.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "download_acs");
        }
    });
    mnOther.add(mntmAemAcs);

    // Adding the menu bar
    frameMain.setJMenuBar(menuBar);

    // Adding other form elements
    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(24, 163, 650, 230);
    frameMain.getContentPane().add(scrollPane);

    final JTextArea textArea = new JTextArea("");
    textArea.setEditable(false);
    scrollPane.setViewportView(textArea);

    // List of demo machines available
    JScrollPane scrollDemoList = new JScrollPane();
    scrollDemoList.setBounds(24, 34, 208, 100);
    frameMain.getContentPane().add(scrollDemoList);
    listModelDemoMachines = AemDemoUtils.listDemoMachines(buildFile.getParentFile().getAbsolutePath());
    listDemoMachines = new JList(listModelDemoMachines);
    listDemoMachines.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listDemoMachines.setSelectedIndex(AemDemoUtils.getSelectedIndex(listDemoMachines,
            this.getDefaultProperties(), this.getPersonalProperties(), AemDemoConstants.OPTIONS_BUILD_DEFAULT));
    scrollDemoList.setViewportView(listDemoMachines);

    // Capturing the output stream of ANT commands
    AemDemoOutputStream out = new AemDemoOutputStream(textArea);
    System.setOut(new PrintStream(out));

    JButton btnStart = new JButton("Start");
    btnStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            AemDemoUtils.antTarget(AemDemo.this, "start");

        }
    });

    btnStart.setBounds(250, 29, 117, 29);
    frameMain.getContentPane().add(btnStart);

    // Set Start as the default button
    JRootPane rootPane = SwingUtilities.getRootPane(btnStart);
    rootPane.setDefaultButton(btnStart);

    JButton btnInfo = new JButton("Details");
    btnInfo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            AemDemoUtils.antTarget(AemDemo.this, "details");

        }
    });
    btnInfo.setBounds(250, 59, 117, 29);
    frameMain.getContentPane().add(btnInfo);

    // Rebuild action
    JButton btnRebuild = new JButton("Rebuild");
    btnRebuild.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            if (AemDemo.this.getBuildInProgress()) {

                JOptionPane.showMessageDialog(null,
                        "A Demo Environment is currently being built. Please wait until it is finished.");

            } else {

                final AemDemoRebuild dialogRebuild = new AemDemoRebuild(AemDemo.this);
                dialogRebuild.setModal(true);
                dialogRebuild.setVisible(true);
                dialogRebuild.getDemoBuildName().requestFocus();
                ;

            }

        }
    });

    btnRebuild.setBounds(250, 89, 117, 29);
    frameMain.getContentPane().add(btnRebuild);

    // Stop action 
    JButton btnStop = new JButton("Stop");
    btnStop.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            int dialogResult = JOptionPane.showConfirmDialog(null,
                    "Are you sure you really want to stop the running instances?", "Warning",
                    JOptionPane.YES_NO_OPTION);
            if (dialogResult == JOptionPane.NO_OPTION) {
                return;
            }
            AemDemoUtils.antTarget(AemDemo.this, "stop");

        }
    });
    btnStop.setBounds(500, 29, 117, 29);
    frameMain.getContentPane().add(btnStop);

    JButton btnExit = new JButton("Exit");
    btnExit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(-1);
        }
    });
    btnExit.setBounds(550, 408, 117, 29);
    frameMain.getContentPane().add(btnExit);

    JButton btnClear = new JButton("Clear");
    btnClear.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            textArea.setText("");
        }
    });
    btnClear.setBounds(40, 408, 117, 29);
    frameMain.getContentPane().add(btnClear);

    JButton btnBackup = new JButton("Backup");
    btnBackup.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "backup");
        }
    });
    btnBackup.setBounds(500, 59, 117, 29);
    frameMain.getContentPane().add(btnBackup);

    JButton btnRestore = new JButton("Restore");
    btnRestore.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            AemDemoUtils.antTarget(AemDemo.this, "restore");
        }
    });
    btnRestore.setBounds(500, 89, 117, 29);
    frameMain.getContentPane().add(btnRestore);

    JButton btnDelete = new JButton("Delete");
    btnDelete.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int dialogResult = JOptionPane.showConfirmDialog(null,
                    "Are you sure you really want to permanently delete the selected demo configuration?",
                    "Warning", JOptionPane.YES_NO_OPTION);
            if (dialogResult == JOptionPane.NO_OPTION) {
                return;
            }
            AemDemoUtils.antTarget(AemDemo.this, "uninstall");
        }
    });
    btnDelete.setBounds(500, 119, 117, 29);
    frameMain.getContentPane().add(btnDelete);

    JLabel lblSelectYourDemo = new JLabel("Select your Demo Environment");
    lblSelectYourDemo.setBounds(24, 10, 219, 16);
    frameMain.getContentPane().add(lblSelectYourDemo);

    JLabel lblCommandOutput = new JLabel("Command Output");
    lblCommandOutput.setBounds(24, 143, 160, 16);
    frameMain.getContentPane().add(lblCommandOutput);

    // Initializing and launching the ticker
    String tickerOn = AemDemoUtils.getPropertyValue(buildFile, "demo.ticker");
    if (tickerOn == null || (tickerOn != null && tickerOn.equals("true"))) {
        AemDemoMarquee mp = new AemDemoMarquee(AemDemoConstants.Credits, 60);
        mp.setBounds(140, 440, 650, 30);
        frameMain.getContentPane().add(mp);
        mp.start();
    }

    // Launching the download tracker task
    AemDemoDownload aemDownload = new AemDemoDownload(AemDemo.this);
    ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
    executor.scheduleAtFixedRate(aemDownload, 0, 5, TimeUnit.SECONDS);

    // Loading up the README.md file
    String line = null;
    try {
        FileReader fileReader = new FileReader(
                buildFile.getParentFile().getAbsolutePath() + File.separator + "README.md");
        BufferedReader bufferedReader = new BufferedReader(fileReader);
        while ((line = bufferedReader.readLine()) != null) {
            if (line.indexOf("AEM Demo Machine!") > 0) {
                line = line + " (version: " + aemDemoMachineVersion + ")";
            }
            if (!line.startsWith("Double"))
                System.out.println(line);
        }
        bufferedReader.close();
    } catch (Exception ex) {
        logger.error(ex.getMessage());
    }

}

From source file:org.jas.gui.MainWindow.java

private void registerKeyStrokeAction() {
    KeyStroke ctrlo = KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK);
    KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
    inputMap = getOpenButton().getInputMap(JButton.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(ctrlo, CTRL_O);/*from   www  .j  a v a 2  s. co m*/
    inputMap.put(enter, ENTER);
    getOpenButton().getActionMap().put(CTRL_O, new ClickAction(getOpenButton()));
    getOpenButton().getActionMap().put(ENTER, new ClickAction(getOpenButton()));
}

From source file:oct.analysis.application.OCTAnalysisUI.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from  w ww. ja  v  a 2  s .com
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

    lrpButtonGroup = new javax.swing.ButtonGroup();
    analysisToolBarBtnGroup = new javax.swing.ButtonGroup();
    toolsToolBarBtnGroup = new javax.swing.ButtonGroup();
    lrpSelectionWidthBean = new oct.analysis.application.dat.LRPSelectionWidthBean();
    resizeOCTSelectionMouseMonitor = new oct.analysis.application.comp.ResizeOCTSelectionMouseMonitor();
    octAnalysisPanel = new oct.analysis.application.OCTImagePanel();
    filterPanel = new javax.swing.JPanel();
    filtersToolbar = new javax.swing.JToolBar();
    jPanel1 = new javax.swing.JPanel();
    lrpSmoothingPanel = new javax.swing.JPanel();
    lrpSmoothingSlider = new javax.swing.JSlider();
    octSmoothingPanel = new javax.swing.JPanel();
    octSmoothingSlider = new javax.swing.JSlider();
    sharpRadiusPanel = new javax.swing.JPanel();
    octSharpRadiusSlider = new javax.swing.JSlider();
    octSharpWeightPanel = new javax.swing.JPanel();
    octSharpWeightSlider = new javax.swing.JSlider();
    analysisToolsToolBar = new javax.swing.JToolBar();
    foveaSelectButton = new javax.swing.JToggleButton();
    singleSelectButton = new javax.swing.JToggleButton();
    screenSelectButton = new javax.swing.JToggleButton();
    jLabel1 = new javax.swing.JLabel();
    lrpWidthTextField = new javax.swing.JFormattedTextField();
    displayPanel = new javax.swing.JPanel();
    positionPanel = new javax.swing.JPanel();
    mousePositionLabel = new oct.analysis.application.comp.MousePositionListeningLabel();
    filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0),
            new java.awt.Dimension(32767, 0));
    jPanel2 = new javax.swing.JPanel();
    mouseDistanceToFoveaLabel = new oct.analysis.application.comp.MouseDistanceToFoveaListeningLabel();
    filler4 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0),
            new java.awt.Dimension(32767, 0));
    dispControlPanel = new javax.swing.JPanel();
    dispSelectionsCheckBox = new javax.swing.JCheckBox();
    filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0),
            new java.awt.Dimension(32767, 0));
    dispSegmentationCheckBox = new javax.swing.JCheckBox();
    filler3 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0),
            new java.awt.Dimension(32767, 0));
    scaleBarCheckBox = new javax.swing.JCheckBox();
    filler5 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0),
            new java.awt.Dimension(32767, 0));
    imageLabel = new javax.swing.JLabel();
    logModeOCTButton = new javax.swing.JRadioButton();
    linearOCTModeButton = new javax.swing.JRadioButton();
    appMenuBar = new javax.swing.JMenuBar();
    fileMenu = new javax.swing.JMenu();
    newAnalysisMenuItem = new javax.swing.JMenuItem();
    openAnalysisMenuItem = new javax.swing.JMenuItem();
    saveAnalysisMenuItem = new javax.swing.JMenuItem();
    exportAnalysisResultsMenuItem = new javax.swing.JMenuItem();
    Exit = new javax.swing.JMenuItem();
    analysisMenu = new javax.swing.JMenu();
    equidistantAutoMenuItem = new javax.swing.JMenuItem();
    equidistantInteractiveMenuItem = new javax.swing.JMenuItem();
    autoEzMenuItem = new javax.swing.JMenuItem();
    interactiveEzMenuItem = new javax.swing.JMenuItem();
    singleLRPAnalysisMenuItem = new javax.swing.JMenuItem();
    autoMirrorMenuItem = new javax.swing.JMenuItem();
    interactiveMirrorAnalysisMenuItem = new javax.swing.JMenuItem();
    autoFoveaFindMenuItem = new javax.swing.JMenuItem();
    interactiveFindFoveaMenuItem = new javax.swing.JMenuItem();
    toolsMenu = new javax.swing.JMenu();
    foveaSelectMenuItem = new javax.swing.JCheckBoxMenuItem();
    singleSelectMenuItem = new javax.swing.JCheckBoxMenuItem();
    lrpMenuItem = new javax.swing.JMenuItem();
    toolbarsMenu = new javax.swing.JMenu();
    filtersTBMenuItem = new javax.swing.JCheckBoxMenuItem();

    org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, lrpWidthTextField,
            org.jdesktop.beansbinding.ELProperty.create("${value}"), lrpSelectionWidthBean,
            org.jdesktop.beansbinding.BeanProperty.create("lrpSelectionWidth"));
    bindingGroup.addBinding(binding);

    lrpSelectionWidthBean.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            lrpSelectionWidthBeanPropertyChange(evt);
        }
    });

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("OCT Reflectivity Analytics");
    setIconImage(new ImageIcon(getClass().getResource("/oct/rsc/icon/logo.png")).getImage());
    setLocationByPlatform(true);
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosed(java.awt.event.WindowEvent evt) {
            formWindowClosed(evt);
        }
    });

    octAnalysisPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    octAnalysisPanel.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            octAnalysisPanelMouseClicked(evt);
        }
    });
    octAnalysisPanel.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            octAnalysisPanelKeyPressed(evt);
        }

        public void keyTyped(java.awt.event.KeyEvent evt) {
            octAnalysisPanelKeyTyped(evt);
        }
    });

    javax.swing.GroupLayout octAnalysisPanelLayout = new javax.swing.GroupLayout(octAnalysisPanel);
    octAnalysisPanel.setLayout(octAnalysisPanelLayout);
    octAnalysisPanelLayout.setHorizontalGroup(octAnalysisPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE));
    octAnalysisPanelLayout.setVerticalGroup(octAnalysisPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE));

    filterPanel.setLayout(new java.awt.BorderLayout());

    filtersToolbar.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    filtersToolbar.setOrientation(javax.swing.SwingConstants.VERTICAL);
    filtersToolbar.setRollover(true);
    filtersToolbar.setName("OCT Filters Toolbar"); // NOI18N

    lrpSmoothingPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("LRP Smoothing Factor"));

    lrpSmoothingSlider.setMajorTickSpacing(5);
    lrpSmoothingSlider.setMaximum(51);
    lrpSmoothingSlider.setMinimum(1);
    lrpSmoothingSlider.setMinorTickSpacing(1);
    lrpSmoothingSlider.setPaintLabels(true);
    lrpSmoothingSlider.setPaintTicks(true);
    lrpSmoothingSlider.setSnapToTicks(true);
    lrpSmoothingSlider
            .setToolTipText("Adjust the smoothing applied to LRPs (values of 0 and 1 have the same effect)");
    lrpSmoothingSlider.setValue(5);
    lrpSmoothingSlider.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            lrpSmoothingSliderStateChanged(evt);
        }
    });

    javax.swing.GroupLayout lrpSmoothingPanelLayout = new javax.swing.GroupLayout(lrpSmoothingPanel);
    lrpSmoothingPanel.setLayout(lrpSmoothingPanelLayout);
    lrpSmoothingPanelLayout.setHorizontalGroup(
            lrpSmoothingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    lrpSmoothingSlider, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    lrpSmoothingPanelLayout.setVerticalGroup(
            lrpSmoothingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    lrpSmoothingSlider, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

    octSmoothingPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("OCT Smoothing Factor"));

    octSmoothingSlider.setMajorTickSpacing(5);
    octSmoothingSlider.setMaximum(50);
    octSmoothingSlider.setMinorTickSpacing(1);
    octSmoothingSlider.setPaintLabels(true);
    octSmoothingSlider.setPaintTicks(true);
    octSmoothingSlider.setSnapToTicks(true);
    octSmoothingSlider
            .setToolTipText("Adjust the smoothing of the OCT image (performed using a 3x3 Gausian blur)");
    octSmoothingSlider.setValue(0);
    octSmoothingSlider.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            octSmoothingSliderStateChanged(evt);
        }
    });

    javax.swing.GroupLayout octSmoothingPanelLayout = new javax.swing.GroupLayout(octSmoothingPanel);
    octSmoothingPanel.setLayout(octSmoothingPanelLayout);
    octSmoothingPanelLayout.setHorizontalGroup(
            octSmoothingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    octSmoothingSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE));
    octSmoothingPanelLayout.setVerticalGroup(
            octSmoothingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    octSmoothingSlider, javax.swing.GroupLayout.Alignment.TRAILING,
                    javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE));

    sharpRadiusPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("OCT Sharpen Radius"));

    octSharpRadiusSlider.setMajorTickSpacing(20);
    octSharpRadiusSlider.setMaximum(200);
    octSharpRadiusSlider.setMinorTickSpacing(5);
    octSharpRadiusSlider.setPaintLabels(true);
    octSharpRadiusSlider.setPaintTicks(true);
    octSharpRadiusSlider.setSnapToTicks(true);
    octSharpRadiusSlider.setToolTipText(
            "Adjust the number of pixels (as a radius) used to sharpen OCT at each given point");
    octSharpRadiusSlider.setValue(0);
    octSharpRadiusSlider.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            octSharpRadiusSliderStateChanged(evt);
        }
    });

    javax.swing.GroupLayout sharpRadiusPanelLayout = new javax.swing.GroupLayout(sharpRadiusPanel);
    sharpRadiusPanel.setLayout(sharpRadiusPanelLayout);
    sharpRadiusPanelLayout.setHorizontalGroup(
            sharpRadiusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    octSharpRadiusSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE));
    sharpRadiusPanelLayout.setVerticalGroup(
            sharpRadiusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    octSharpRadiusSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE));

    octSharpWeightPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("OCT Sharpen Weight Factor"));

    octSharpWeightSlider.setMajorTickSpacing(10);
    octSharpWeightSlider.setMinorTickSpacing(2);
    octSharpWeightSlider.setPaintLabels(true);
    octSharpWeightSlider.setPaintTicks(true);
    octSharpWeightSlider.setToolTipText("Adjust the weighting factor given to the sharpened pixel information");
    octSharpWeightSlider.setValue(0);
    octSharpWeightSlider.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            octSharpWeightSliderStateChanged(evt);
        }
    });

    javax.swing.GroupLayout octSharpWeightPanelLayout = new javax.swing.GroupLayout(octSharpWeightPanel);
    octSharpWeightPanel.setLayout(octSharpWeightPanelLayout);
    octSharpWeightPanelLayout.setHorizontalGroup(
            octSharpWeightPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(octSharpWeightSlider, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    octSharpWeightPanelLayout.setVerticalGroup(octSharpWeightPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(octSharpWeightSlider,
                    javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 73,
                    javax.swing.GroupLayout.PREFERRED_SIZE));

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(octSmoothingPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lrpSmoothingPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(sharpRadiusPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(octSharpWeightPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))));
    jPanel1Layout
            .setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGroup(jPanel1Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(sharpRadiusPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(lrpSmoothingPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGap(6, 6, 6)
                            .addGroup(jPanel1Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(octSharpWeightPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(octSmoothingPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(0, 0, Short.MAX_VALUE)));

    filtersToolbar.add(jPanel1);

    filterPanel.add(filtersToolbar, java.awt.BorderLayout.CENTER);
    filtersToolbar.addAncestorListener(new ToolbarFloatListener(filtersToolbar, this));

    analysisToolsToolBar.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    analysisToolsToolBar.setRollover(true);

    foveaSelectButton.setAction(foveaSelectMenuItem.getAction());
    toolsToolBarBtnGroup.add(foveaSelectButton);
    foveaSelectButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/oct/rsc/icon/FVselect.png"))); // NOI18N
    foveaSelectButton.setToolTipText("Fovea Selection Selector Tool");
    foveaSelectButton.setEnabled(false);
    foveaSelectButton.setFocusable(false);
    foveaSelectButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    foveaSelectButton.setSelectedIcon(
            new javax.swing.ImageIcon(getClass().getResource("/oct/rsc/icon/FVselectSelected.png"))); // NOI18N
    foveaSelectButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    foveaSelectButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            foveaSelectButtonActionPerformed(evt);
        }
    });
    analysisToolsToolBar.add(foveaSelectButton);

    singleSelectButton.setAction(singleSelectMenuItem.getAction());
    toolsToolBarBtnGroup.add(singleSelectButton);
    singleSelectButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/oct/rsc/icon/SingleSelectIcon.png"))); // NOI18N
    singleSelectButton.setToolTipText("Selection Selector Tool");
    singleSelectButton.setEnabled(false);
    singleSelectButton.setFocusable(false);
    singleSelectButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    singleSelectButton.setSelectedIcon(
            new javax.swing.ImageIcon(getClass().getResource("/oct/rsc/icon/SingleSelectSelectedIcon.png"))); // NOI18N
    singleSelectButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    singleSelectButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            singleSelectButtonActionPerformed(evt);
        }
    });
    analysisToolsToolBar.add(singleSelectButton);

    toolsToolBarBtnGroup.add(screenSelectButton);
    screenSelectButton.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/oct/rsc/icon/mouse-pointer-th_19x25.png"))); // NOI18N
    screenSelectButton.setToolTipText("Selection Pointer Tool");
    screenSelectButton.setEnabled(false);
    screenSelectButton.setFocusable(false);
    screenSelectButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    screenSelectButton.setName(""); // NOI18N
    screenSelectButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    screenSelectButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            screenSelectButtonActionPerformed(evt);
        }
    });
    analysisToolsToolBar.add(screenSelectButton);

    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel1.setLabelFor(lrpWidthTextField);
    jLabel1.setText("LRP Selection Width:");
    jLabel1.setToolTipText("Width (in pixels) of the LRP selections on the OCT");
    jLabel1.setFocusable(false);
    jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    jLabel1.setMaximumSize(new java.awt.Dimension(105, 14));
    analysisToolsToolBar.add(jLabel1);

    lrpWidthTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(
            new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
    lrpWidthTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
    lrpWidthTextField.setText("5");
    lrpWidthTextField.setToolTipText("Set the width of the LRP selections (in pixels)");
    lrpWidthTextField.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
    lrpWidthTextField.setMaximumSize(new java.awt.Dimension(35, 25));
    lrpWidthTextField.setMinimumSize(new java.awt.Dimension(35, 25));
    lrpWidthTextField.setPreferredSize(new java.awt.Dimension(35, 25));
    analysisToolsToolBar.add(lrpWidthTextField);

    displayPanel.setLayout(new javax.swing.BoxLayout(displayPanel, javax.swing.BoxLayout.LINE_AXIS));

    positionPanel.setBorder(javax.swing.BorderFactory
            .createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Position"));
    positionPanel.setPreferredSize(new java.awt.Dimension(80, 47));

    mousePositionLabel.setText("Mouse Position");

    javax.swing.GroupLayout positionPanelLayout = new javax.swing.GroupLayout(positionPanel);
    positionPanel.setLayout(positionPanelLayout);
    positionPanelLayout.setHorizontalGroup(
            positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    mousePositionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE));
    positionPanelLayout.setVerticalGroup(
            positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    mousePositionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE));

    displayPanel.add(positionPanel);
    displayPanel.add(filler1);

    jPanel2.setBorder(javax.swing.BorderFactory
            .createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "To Fovea"));
    jPanel2.setPreferredSize(new java.awt.Dimension(60, 47));

    mouseDistanceToFoveaLabel.setText("Distance");

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout
            .setHorizontalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(mouseDistanceToFoveaLabel, javax.swing.GroupLayout.Alignment.TRAILING,
                            javax.swing.GroupLayout.DEFAULT_SIZE, 63, Short.MAX_VALUE));
    jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                    mouseDistanceToFoveaLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE));

    displayPanel.add(jPanel2);
    displayPanel.add(filler4);

    dispControlPanel.setBorder(javax.swing.BorderFactory
            .createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Display Control"));
    dispControlPanel.setLayout(new javax.swing.BoxLayout(dispControlPanel, javax.swing.BoxLayout.LINE_AXIS));

    dispSelectionsCheckBox.setSelected(true);
    dispSelectionsCheckBox.setText("LRP Selections");
    dispSelectionsCheckBox.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            dispSelectionsCheckBoxStateChanged(evt);
        }
    });
    dispControlPanel.add(dispSelectionsCheckBox);
    dispControlPanel.add(filler2);

    dispSegmentationCheckBox.setText("Segmentation");
    dispSegmentationCheckBox.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            dispSegmentationCheckBoxStateChanged(evt);
        }
    });
    dispSegmentationCheckBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            dispSegmentationCheckBoxActionPerformed(evt);
        }
    });
    dispControlPanel.add(dispSegmentationCheckBox);
    dispControlPanel.add(filler3);

    scaleBarCheckBox.setText("Scale Bars");
    scaleBarCheckBox.setToolTipText("Show or hide scale bars on the image");
    scaleBarCheckBox.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            scaleBarCheckBoxStateChanged(evt);
        }
    });
    scaleBarCheckBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            scaleBarCheckBoxActionPerformed(evt);
        }
    });
    dispControlPanel.add(scaleBarCheckBox);
    dispControlPanel.add(filler5);

    imageLabel.setText("Image:");
    dispControlPanel.add(imageLabel);

    lrpButtonGroup.add(logModeOCTButton);
    logModeOCTButton.setSelected(true);
    logModeOCTButton.setText("Logrithmic OCT");
    logModeOCTButton.setToolTipText("Display the OCT image as a Logrithmic Image");
    logModeOCTButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            logModeOCTButtonActionPerformed(evt);
        }
    });
    dispControlPanel.add(logModeOCTButton);

    lrpButtonGroup.add(linearOCTModeButton);
    linearOCTModeButton.setText("Linear OCT");
    linearOCTModeButton.setToolTipText("Display the OCT image as a Linear Image");
    linearOCTModeButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            linearOCTModeButtonActionPerformed(evt);
        }
    });
    dispControlPanel.add(linearOCTModeButton);

    displayPanel.add(dispControlPanel);

    fileMenu.setText("File");

    newAnalysisMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N,
            java.awt.event.InputEvent.CTRL_MASK));
    newAnalysisMenuItem.setText("New Analysis");
    newAnalysisMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            newAnalysisMenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(newAnalysisMenuItem);

    openAnalysisMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O,
            java.awt.event.InputEvent.CTRL_MASK));
    openAnalysisMenuItem.setText("Open Analysis");
    openAnalysisMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            openAnalysisMenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(openAnalysisMenuItem);

    saveAnalysisMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            java.awt.event.InputEvent.CTRL_MASK));
    saveAnalysisMenuItem.setText("Save Analysis");
    saveAnalysisMenuItem.setEnabled(false);
    saveAnalysisMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveAnalysisMenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(saveAnalysisMenuItem);

    exportAnalysisResultsMenuItem.setAccelerator(javax.swing.KeyStroke
            .getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK));
    exportAnalysisResultsMenuItem.setText("Export Analysis Results");
    exportAnalysisResultsMenuItem.setEnabled(false);
    exportAnalysisResultsMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exportAnalysisResultsMenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(exportAnalysisResultsMenuItem);

    Exit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q,
            java.awt.event.InputEvent.CTRL_MASK));
    Exit.setText("Quit");
    Exit.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ExitActionPerformed(evt);
        }
    });
    fileMenu.add(Exit);

    appMenuBar.add(fileMenu);

    analysisMenu.setText("Analysis");
    analysisMenu.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            analysisMenuActionPerformed(evt);
        }
    });

    equidistantAutoMenuItem.setText("Equidistant (automatic)");
    equidistantAutoMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            equidistantAutoMenuItemActionPerformed(evt);
        }
    });
    analysisMenu.add(equidistantAutoMenuItem);

    equidistantInteractiveMenuItem.setText("Equidistant (interactive)");
    equidistantInteractiveMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            equidistantInteractiveMenuItemActionPerformed(evt);
        }
    });
    analysisMenu.add(equidistantInteractiveMenuItem);

    autoEzMenuItem.setText("EZ (automatic)");
    autoEzMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            autoEzMenuItemActionPerformed(evt);
        }
    });
    analysisMenu.add(autoEzMenuItem);

    interactiveEzMenuItem.setText("EZ (interactive)");
    interactiveEzMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            interactiveEzMenuItemActionPerformed(evt);
        }
    });
    analysisMenu.add(interactiveEzMenuItem);

    singleLRPAnalysisMenuItem.setText("Single");
    singleLRPAnalysisMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            singleLRPAnalysisMenuItemActionPerformed(evt);
        }
    });
    analysisMenu.add(singleLRPAnalysisMenuItem);

    autoMirrorMenuItem.setText("Mirror (automatic)");
    autoMirrorMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            autoMirrorMenuItemActionPerformed(evt);
        }
    });
    analysisMenu.add(autoMirrorMenuItem);

    interactiveMirrorAnalysisMenuItem.setText("Mirror (interactive)");
    interactiveMirrorAnalysisMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            interactiveMirrorAnalysisMenuItemActionPerformed(evt);
        }
    });
    analysisMenu.add(interactiveMirrorAnalysisMenuItem);

    autoFoveaFindMenuItem.setText("Find Fovea (automatic)");
    autoFoveaFindMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            autoFoveaFindMenuItemActionPerformed(evt);
        }
    });
    analysisMenu.add(autoFoveaFindMenuItem);

    interactiveFindFoveaMenuItem.setText("Find Fovea (interactive)");
    interactiveFindFoveaMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            interactiveFindFoveaMenuItemActionPerformed(evt);
        }
    });
    analysisMenu.add(interactiveFindFoveaMenuItem);

    appMenuBar.add(analysisMenu);

    toolsMenu.setText("Tools");
    toolsMenu.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            toolsMenuActionPerformed(evt);
        }
    });

    foveaSelectMenuItem.setText("Select Fovea");
    foveaSelectMenuItem.setEnabled(false);
    foveaSelectMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            foveaSelectMenuItemActionPerformed(evt);
        }
    });
    toolsMenu.add(foveaSelectMenuItem);

    singleSelectMenuItem.setText("Select Single");
    singleSelectMenuItem.setEnabled(false);
    singleSelectMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            singleSelectMenuItemActionPerformed(evt);
        }
    });
    toolsMenu.add(singleSelectMenuItem);

    lrpMenuItem.setText("Generate LRPs");
    lrpMenuItem.setEnabled(false);
    lrpMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            lrpMenuItemActionPerformed(evt);
        }
    });
    toolsMenu.add(lrpMenuItem);

    appMenuBar.add(toolsMenu);

    toolbarsMenu.setText("Toolbars");

    filtersTBMenuItem.setSelected(true);
    filtersTBMenuItem.setText("Filters Toolbar");
    filtersTBMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            filtersTBMenuItemActionPerformed(evt);
        }
    });
    toolbarsMenu.add(filtersTBMenuItem);

    appMenuBar.add(toolbarsMenu);

    setJMenuBar(appMenuBar);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(octAnalysisPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(displayPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 736, Short.MAX_VALUE))
            .addComponent(filterPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(analysisToolsToolBar, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addComponent(analysisToolsToolBar, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(octAnalysisPanel, javax.swing.GroupLayout.DEFAULT_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(displayPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 47,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(filterPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)));

    analysisToolsToolBar.setFloatable(false);

    bindingGroup.bind();

    pack();
}