Example usage for java.awt.event KeyEvent VK_N

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

Introduction

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

Prototype

int VK_N

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

Click Source Link

Document

Constant for the "N" key.

Usage

From source file:jchrest.gui.Shell.java

private JMenu createModelMenu(int time) {
    JMenu menu = new JMenu("Model");
    menu.setMnemonic(KeyEvent.VK_M);
    menu.add(new ClearModelAction(this));
    menu.getItem(0).setMnemonic(KeyEvent.VK_C);

    JMenu submenu = new JMenu("Save");
    submenu.setMnemonic(KeyEvent.VK_S);
    submenu.add(new SaveModelAsVnaAction(this, time));
    submenu.getItem(0).setMnemonic(KeyEvent.VK_N);
    submenu.add(new SaveModelSemanticLinksAsVnaAction(this, time));
    submenu.getItem(1).setMnemonic(KeyEvent.VK_L);
    menu.add(submenu);/*from  w ww  . j a  va2  s .  c o  m*/

    menu.add(new ModelPropertiesAction(this));
    menu.getItem(2).setMnemonic(KeyEvent.VK_P);
    menu.add(new JSeparator());
    menu.add(new ModelInformationAction(this, time));
    menu.getItem(4).setMnemonic(KeyEvent.VK_I);
    menu.add(new ViewModelAction(this));
    menu.getItem(5).setMnemonic(KeyEvent.VK_V);

    return menu;
}

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./* www.j  a  v  a  2 s .c  o  m*/
 */
@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();
}

From source file:io.heming.accountbook.ui.MainFrame.java

private void initMenuBar() {
    JMenuBar menuBar = new JMenuBar();

    // File menu//from   w  w w .  j  a v a2 s . com
    fileMenu = new JMenu("(F)");
    fileMenu.setMnemonic('F');

    exportMenuItem = new JMenuItem("(B)...");
    exportMenuItem.setIcon(new ImageIcon(getClass().getResource("database-save.png")));
    exportMenuItem.setMnemonic('B');
    exportMenuItem.addActionListener(e -> exportRecords());
    fileMenu.add(exportMenuItem);

    importMenuItem = new JMenuItem("??(R)...");
    importMenuItem.setIcon(new ImageIcon(getClass().getResource("document-import-2.png")));
    importMenuItem.setMnemonic('R');
    importMenuItem.addActionListener(e -> importRecords());
    fileMenu.add(importMenuItem);

    fileMenu.addSeparator();

    quitMenuItem = new JMenuItem("(X)");
    quitMenuItem.setIcon(new ImageIcon(getClass().getResource("application-exit-2.png")));
    quitMenuItem.setMnemonic('X');
    quitMenuItem.addActionListener(e -> quit());
    fileMenu.add(quitMenuItem);

    // View menu
    viewMenu = new JMenu("(V)");
    viewMenu.setMnemonic('V');

    searchMenuItem = new JMenuItem("?(S)");
    searchMenuItem.setIcon(new ImageIcon(getClass().getResource("edit-find-5.png")));
    searchMenuItem.setMnemonic('S');
    searchMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));
    searchMenuItem.addActionListener(e -> searchRecords());
    viewMenu.add(searchMenuItem);

    keywordMenuItem = new JMenuItem("(K)");
    keywordMenuItem.setIcon(new ImageIcon(getClass().getResource("text-field.png")));
    keywordMenuItem.setMnemonic('K');
    keywordMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK));
    keywordMenuItem.addActionListener(e -> {
        keywordTextField.requestFocus();
        keywordTextField.selectAll();
    });
    viewMenu.add(keywordMenuItem);

    viewMenu.addSeparator();

    prevPageMenuItem = new JMenuItem("?(P)");
    prevPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-previous-2.png")));
    prevPageMenuItem.setMnemonic('P');
    prevPageMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.CTRL_MASK));
    prevPageMenuItem.addActionListener(e -> prevPage());
    viewMenu.add(prevPageMenuItem);

    nextPageMenuItem = new JMenuItem("(N)");
    nextPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-next-2.png")));
    nextPageMenuItem.setMnemonic('N');
    nextPageMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.CTRL_MASK));
    nextPageMenuItem.addActionListener(e -> nextPage());
    viewMenu.add(nextPageMenuItem);

    firstPageMenuItem = new JMenuItem("(F)");
    firstPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-first.png")));
    firstPageMenuItem.setMnemonic('F');
    firstPageMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.SHIFT_MASK + Event.CTRL_MASK));
    firstPageMenuItem.addActionListener(e -> firstPage());
    viewMenu.add(firstPageMenuItem);

    lastPageMenuItem = new JMenuItem("(L)");
    lastPageMenuItem.setIcon(new ImageIcon(getClass().getResource("go-last.png")));
    lastPageMenuItem.setMnemonic('L');
    lastPageMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.SHIFT_MASK + Event.CTRL_MASK));
    lastPageMenuItem.addActionListener(e -> lastPage());
    viewMenu.add(lastPageMenuItem);

    // Edit menu
    editMenu = new JMenu("(E)");
    editMenu.setMnemonic('E');

    addRecordMenuItem = new JMenuItem("(A)...");
    addRecordMenuItem.setIcon(new ImageIcon(getClass().getResource("edit-add-3.png")));
    addRecordMenuItem.setMnemonic('A');
    addRecordMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK));
    addRecordMenuItem.addActionListener(e -> showAddRecordDialog());
    editMenu.add(addRecordMenuItem);

    //        deleteRecordMenuItem = new JMenuItem("(D)");
    //        deleteRecordMenuItem.setIcon(new ImageIcon(getClass().getResource("edit-delete-6.png")));
    //        deleteRecordMenuItem.setMnemonic('D');
    //        deleteRecordMenuItem.addActionListener(e -> deleteRecord());
    //        editMenu.add(deleteRecordMenuItem);

    editMenu.addSeparator();

    categoryMenuItem = new JMenuItem("???(T)...");
    categoryMenuItem.setIcon(new ImageIcon(getClass().getResource("view-list-icons-2.png")));
    categoryMenuItem.setMnemonic('T');
    categoryMenuItem.addActionListener(e -> showCategoryDialog());
    editMenu.add(categoryMenuItem);

    // Help menu
    helpMenu = new JMenu("(H)");
    helpMenu.setMnemonic('H');

    helpMenuItem = new JMenuItem("(I)");
    helpMenuItem.setIcon(new ImageIcon(getClass().getResource("help-2.png")));
    helpMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
    helpMenuItem.setMnemonic('I');
    helpMenuItem.addActionListener(e -> help());
    helpMenu.add(helpMenuItem);

    aboutMenuItem = new JMenuItem("(A)");
    aboutMenuItem.setIcon(new ImageIcon(getClass().getResource("help-about-2.png")));
    aboutMenuItem.setMnemonic('A');
    aboutMenuItem.addActionListener(e -> about());
    helpMenu.add(aboutMenuItem);

    // Add menu to menu bar
    menuBar.add(fileMenu);
    menuBar.add(editMenu);
    menuBar.add(viewMenu);
    menuBar.add(helpMenu);
    setJMenuBar(menuBar);
}

From source file:org.sikuli.ide.SikuliIDE.java

private void initFileMenu() throws NoSuchMethodException {
    JMenuItem jmi;//from www  .  ja v a 2 s .co  m
    int scMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
    _fileMenu.setMnemonic(java.awt.event.KeyEvent.VK_F);

    if (showAbout) {
        _fileMenu.add(
                createMenuItem("About SikuliX", KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, scMask),
                        new FileAction(FileAction.ABOUT)));
        _fileMenu.addSeparator();
    }

    _fileMenu.add(createMenuItem(_I("menuFileNew"),
            KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, scMask), new FileAction(FileAction.NEW)));

    jmi = _fileMenu.add(createMenuItem(_I("menuFileOpen"),
            KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, scMask), new FileAction(FileAction.OPEN)));
    jmi.setName("OPEN");

    recentMenu = new JMenu(_I("menuRecent"));

    if (Settings.experimental) {
        _fileMenu.add(recentMenu);
    }

    if (Settings.isMac() && !Settings.handlesMacBundles) {
        _fileMenu.add(createMenuItem("Open folder.sikuli ...", null,
                //            KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, scMask),
                new FileAction(FileAction.OPEN_FOLDER)));
    }

    jmi = _fileMenu.add(createMenuItem(_I("menuFileSave"),
            KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, scMask), new FileAction(FileAction.SAVE)));
    jmi.setName("SAVE");

    jmi = _fileMenu.add(createMenuItem(_I("menuFileSaveAs"),
            KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, InputEvent.SHIFT_MASK | scMask),
            new FileAction(FileAction.SAVE_AS)));
    jmi.setName("SAVE_AS");

    if (Settings.isMac() && !Settings.handlesMacBundles) {
        _fileMenu.add(createMenuItem(_I("Save as folder.sikuli ..."),
                //            KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
                //            InputEvent.SHIFT_MASK | scMask),
                null, new FileAction(FileAction.SAVE_AS_FOLDER)));
    }

    //TODO    _fileMenu.add(createMenuItem(_I("menuFileSaveAll"),
    _fileMenu.add(createMenuItem("Save all",
            KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, InputEvent.CTRL_MASK | scMask),
            new FileAction(FileAction.SAVE_ALL)));

    _fileMenu.add(createMenuItem(_I("menuFileExport"),
            KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, InputEvent.SHIFT_MASK | scMask),
            new FileAction(FileAction.EXPORT)));

    jmi = _fileMenu.add(
            createMenuItem(_I("menuFileCloseTab"), KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, scMask),
                    new FileAction(FileAction.CLOSE_TAB)));
    jmi.setName("CLOSE_TAB");

    if (showPrefs) {
        _fileMenu.addSeparator();
        _fileMenu.add(createMenuItem(_I("menuFilePreferences"),
                KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, scMask),
                new FileAction(FileAction.PREFERENCES)));
    }

    if (showQuit) {
        _fileMenu.addSeparator();
        _fileMenu.add(createMenuItem(_I("menuFileQuit"), null, new FileAction(FileAction.QUIT)));
    }
}

From source file:haven.GameUI.java

public boolean globtype(char key, KeyEvent ev) {
    if (key == ':') {
        entercmd();/*from   ww w  .ja  v  a2  s .  c  o  m*/
        return (true);
    } else if (key == ' ') {
        toggleui();
        return (true);
    } else if (key == 3) {
        if (chat.visible && !chat.hasfocus) {
            setfocus(chat);
        } else {
            if (chat.sz.y == 0) {
                chat.resize(chat.savedw, chat.savedh);
                setfocus(chat);
            } else {
                chat.resize(0, 0);
            }
        }
        Utils.setprefb("chatvis", chat.sz.y != 0);
    } else if (key == 16) {
        /*
        if((polity != null) && polity.show(!polity.visible)) {
        polity.raise();
        fitwdg(polity);
        setfocus(polity);
        }
        */
        return (true);
    } else if ((key == 27) && (map != null) && !map.hasfocus) {
        setfocus(map);
        return (true);
    } else if (key != 0) {
        boolean alt = ev.isAltDown();
        boolean ctrl = ev.isControlDown();
        boolean shift = ev.isShiftDown();
        int keycode = ev.getKeyCode();
        if (alt && keycode >= KeyEvent.VK_0 && keycode <= KeyEvent.VK_9) {
            beltwdg.setCurrentBelt(Utils.floormod(keycode - KeyEvent.VK_0 - 1, 10));
            return true;
        } else if (alt && keycode == KeyEvent.VK_S) {
            studywnd.show(!studywnd.visible);
            if (studywnd.visible)
                studywnd.raise();
            return true;
        } else if (alt && keycode == KeyEvent.VK_M) {
            if (mmapwnd != null) {
                mmapwnd.togglefold();
                return true;
            }
        } else if (alt && keycode == KeyEvent.VK_C) {
            craftwnd.show(!craftwnd.visible);
            if (craftwnd.visible)
                craftwnd.raise();
            return true;
        } else if (alt && keycode == KeyEvent.VK_B) {
            buildwnd.toggle();
            if (buildwnd.visible)
                buildwnd.raise();
            return true;
        } else if (alt && keycode == KeyEvent.VK_N) {
            Config.nightvision.set(!Config.nightvision.get());
        } else if (alt && keycode == KeyEvent.VK_G) {
            if (map != null)
                map.gridOverlay.setVisible(!map.gridOverlay.isVisible());
            return true;
        } else if (alt && keycode == KeyEvent.VK_R) {
            if (mmap != null)
                mmap.toggleCustomIcons();
            return true;
        } else if (alt && keycode == KeyEvent.VK_D) {
            if (map != null)
                map.toggleGobRadius();
            return true;
        } else if (alt && keycode == KeyEvent.VK_Q) {
            Config.showQuality.set(!Config.showQuality.get());
            return true;
        } else if (alt && keycode == KeyEvent.VK_K) {
            deckwnd.show(!deckwnd.visible);
            deckwnd.c = new Coord(sz.sub(deckwnd.sz).div(2));
            if (deckwnd.visible)
                deckwnd.raise();
            return true;
        } else if (alt && keycode == KeyEvent.VK_F) {
            if (map != null) {
                map.toggleFriendlyFire();
                msg("Friendly fire prevention is now turned "
                        + (map.isPreventFriendlyFireEnabled() ? "on" : "off"));
            }
            return true;
        } else if (alt && keycode == KeyEvent.VK_I) {
            Config.showGobInfo.set(!Config.showGobInfo.get());
            return true;
        } else if (alt && keycode == KeyEvent.VK_W) {
            Config.screenshotMode = !Config.screenshotMode;
            return true;
        } else if (alt && keycode == KeyEvent.VK_T) {
            Config.disableTileTransitions.set(!Config.disableTileTransitions.get());
            ui.sess.glob.map.rebuild();
            return true;
        } else if (keycode == KeyEvent.VK_Q && ev.getModifiers() == 0) {
            /*
            // get all forageables from config
            List<String> names = new ArrayList<String>();
            for (CustomIconGroup group : ui.sess.glob.icons.config.groups) {
                if ("Forageables".equals(group.name)) {
            for (CustomIconMatch match : group.matches)
                if (match.show)
                    names.add(match.value);
            break;
                }
            }
            tasks.add(new Forager(11 * Config.autopickRadius.get(), 1, names.toArray(new String[names.size()]))); 
            */
            ContextTaskFinder.checkForageables(tasks, ui);
            return true;
        } else if (keycode == KeyEvent.VK_E && ev.getModifiers() == 0) {
            ContextTaskFinder.findHandTask(tasks, ui);
            return true;
        } else if (keycode == KeyEvent.VK_F && ev.getModifiers() == 0) {
            ContextTaskFinder.findBuilding(tasks, ui);
            return true;
        } else if (keycode >= KeyEvent.VK_NUMPAD1 && keycode <= KeyEvent.VK_NUMPAD4) {
            tasks.add(new MileStoneTask(Utils.floormod(keycode - KeyEvent.VK_NUMPAD0 - 1, 10)));
            return true;
        } else if (keycode == KeyEvent.VK_W && ev.getModifiers() == 0) {
            tasks.add(new Drunkard());
            return true;
        } else if (shift && keycode == KeyEvent.VK_I) {
            Config.hideKinInfoForNonPlayers.set(!Config.hideKinInfoForNonPlayers.get());
            return true;
        } else if (ctrl && keycode == KeyEvent.VK_H) {
            Config.hideModeEnabled.set(!Config.hideModeEnabled.get());
            return true;
        } else if (alt && keycode == KeyEvent.VK_P) {
            Config.showGobPaths.set(!Config.showGobPaths.get());
            return true;
        } else if (shift && keycode == KeyEvent.VK_W) {
            if (Config.showQualityMode.get() == 1) {
                Config.showQualityMode.set(2);
            } else {
                Config.showQualityMode.set(1);
            }
            return true;
        } else if (keycode == KeyEvent.VK_TAB && Config.agroclosest.get()) {
            if (map != null)
                map.aggroclosest();
            return true;
        } else if (ctrl && keycode == KeyEvent.VK_F) {
            Config.displayFPS.set(!Config.displayFPS.get());
            return true;
        } else if (keycode == KeyEvent.VK_Z && ev.getModifiers() == 0) {
            tasks.killAllTasks();
            return true;
        } else if (keycode == 192 && ev.getModifiers() == 0) {
            getparent(GameUI.class).menu.wdgmsg("act", "travel", "hearth");
            return true;
        } else if (shift && keycode == KeyEvent.VK_S) {
            HavenPanel.screenshot = true;
            return true;
        }
    }
    return (super.globtype(key, ev));
}

From source file:pl.otros.logview.gui.LogViewMainFrame.java

private void initToolbar() {
    toolBar = new JToolBar();
    final JComboBox searchMode = new JComboBox(
            new String[] { "String contains search: ", "Regex search: ", "Query search: " });
    final SearchAction searchActionForward = new SearchAction(otrosApplication, SearchDirection.FORWARD);
    final SearchAction searchActionBackward = new SearchAction(otrosApplication, SearchDirection.REVERSE);
    searchFieldCbxModel = new DefaultComboBoxModel();
    searchField = new JXComboBox(searchFieldCbxModel);
    searchField.setEditable(true);//from   w w  w .j a  v a  2 s  .  c  om
    AutoCompleteDecorator.decorate(searchField);
    searchField.setMinimumSize(new Dimension(150, 10));
    searchField.setPreferredSize(new Dimension(250, 10));
    searchField.setToolTipText(
            "<HTML>Enter text to search.<BR/>" + "Enter - search next,<BR/>Alt+Enter search previous,<BR/>"
                    + "Ctrl+Enter - mark all found</HTML>");
    final DelayedSwingInvoke delayedSearchResultUpdate = new DelayedSwingInvoke() {
        @Override
        protected void performActionHook() {
            JTextComponent editorComponent = (JTextComponent) searchField.getEditor().getEditorComponent();
            int stringEnd = editorComponent.getSelectionStart();
            if (stringEnd < 0) {
                stringEnd = editorComponent.getText().length();
            }
            try {
                String selectedText = editorComponent.getText(0, stringEnd);
                if (StringUtils.isBlank(selectedText)) {
                    return;
                }
                OtrosJTextWithRulerScrollPane<JTextPane> logDetailWithRulerScrollPane = otrosApplication
                        .getSelectedLogViewPanel().getLogDetailWithRulerScrollPane();
                MessageUpdateUtils.highlightSearchResult(logDetailWithRulerScrollPane,
                        otrosApplication.getAllPluginables().getMessageColorizers());
                RulerBarHelper.scrollToFirstMarker(logDetailWithRulerScrollPane);
            } catch (BadLocationException e) {
                LOGGER.log(Level.SEVERE, "Can't update search highlight", e);
            }
        }
    };
    JTextComponent searchFieldTextComponent = (JTextComponent) searchField.getEditor().getEditorComponent();
    searchFieldTextComponent.getDocument().addDocumentListener(new DocumentInsertUpdateHandler() {
        @Override
        protected void documentChanged(DocumentEvent e) {
            delayedSearchResultUpdate.performAction();
        }
    });
    final MarkAllFoundAction markAllFoundAction = new MarkAllFoundAction(otrosApplication);
    final SearchModeValidatorDocumentListener searchValidatorDocumentListener = new SearchModeValidatorDocumentListener(
            (JTextField) searchField.getEditor().getEditorComponent(), observer, SearchMode.STRING_CONTAINS);
    SearchMode searchModeFromConfig = configuration.get(SearchMode.class, "gui.searchMode",
            SearchMode.STRING_CONTAINS);
    final String lastSearchString;
    int selectedSearchMode = 0;
    if (searchModeFromConfig.equals(SearchMode.STRING_CONTAINS)) {
        selectedSearchMode = 0;
        lastSearchString = configuration.getString(ConfKeys.SEARCH_LAST_STRING, "");
    } else if (searchModeFromConfig.equals(SearchMode.REGEX)) {
        selectedSearchMode = 1;
        lastSearchString = configuration.getString(ConfKeys.SEARCH_LAST_REGEX, "");
    } else if (searchModeFromConfig.equals(SearchMode.QUERY)) {
        selectedSearchMode = 2;
        lastSearchString = configuration.getString(ConfKeys.SEARCH_LAST_QUERY, "");
    } else {
        LOGGER.warning("Unknown search mode " + searchModeFromConfig);
        lastSearchString = "";
    }
    Component editorComponent = searchField.getEditor().getEditorComponent();
    if (editorComponent instanceof JTextField) {
        final JTextField sfTf = (JTextField) editorComponent;
        sfTf.getDocument().addDocumentListener(searchValidatorDocumentListener);
        sfTf.getDocument().addDocumentListener(new DocumentInsertUpdateHandler() {
            @Override
            protected void documentChanged(DocumentEvent e) {
                try {
                    int length = e.getDocument().getLength();
                    if (length > 0) {
                        searchResultColorizer.setSearchString(e.getDocument().getText(0, length));
                    }
                } catch (BadLocationException e1) {
                    LOGGER.log(Level.SEVERE, "Error: ", e1);
                }
            }
        });
        sfTf.addKeyListener(new SearchFieldKeyListener(searchActionForward, sfTf));
        sfTf.setText(lastSearchString);
    }
    searchMode.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            SearchMode mode = null;
            boolean validationEnabled = false;
            String confKey = null;
            String lastSearch = ((JTextField) searchField.getEditor().getEditorComponent()).getText();
            if (searchMode.getSelectedIndex() == 0) {
                mode = SearchMode.STRING_CONTAINS;
                searchValidatorDocumentListener.setSearchMode(mode);
                validationEnabled = false;
                searchMode.setToolTipText("Checking if log message contains string (case is ignored)");
                confKey = ConfKeys.SEARCH_LAST_STRING;
            } else if (searchMode.getSelectedIndex() == 1) {
                mode = SearchMode.REGEX;
                validationEnabled = true;
                searchMode
                        .setToolTipText("Checking if log message matches regular expression (case is ignored)");
                confKey = ConfKeys.SEARCH_LAST_REGEX;
            } else if (searchMode.getSelectedIndex() == 2) {
                mode = SearchMode.QUERY;
                validationEnabled = true;
                String querySearchTooltip = "<HTML>" + //
                "Advance search using SQL-like quries (i.e. level>=warning && msg~=failed && thread==t1)<BR/>" + //
                "Valid operator for query search is ==, ~=, !=, LIKE, EXISTS, <, <=, >, >=, &&, ||, ! <BR/>" + //
                "See wiki for more info<BR/>" + //
                "</HTML>";
                searchMode.setToolTipText(querySearchTooltip);
                confKey = ConfKeys.SEARCH_LAST_QUERY;
            }
            searchValidatorDocumentListener.setSearchMode(mode);
            searchValidatorDocumentListener.setEnable(validationEnabled);
            searchActionForward.setSearchMode(mode);
            searchActionBackward.setSearchMode(mode);
            markAllFoundAction.setSearchMode(mode);
            configuration.setProperty("gui.searchMode", mode);
            searchResultColorizer.setSearchMode(mode);
            List<Object> list = configuration.getList(confKey);
            searchFieldCbxModel.removeAllElements();
            for (Object o : list) {
                searchFieldCbxModel.addElement(o);
            }
            searchField.setSelectedItem(lastSearch);
        }
    });
    searchMode.setSelectedIndex(selectedSearchMode);
    final JCheckBox markFound = new JCheckBox("Mark search result");
    markFound.setMnemonic(KeyEvent.VK_M);
    searchField.addKeyListener(markAllFoundAction);
    configuration.addConfigurationListener(markAllFoundAction);
    JButton markAllFoundButton = new JButton(markAllFoundAction);
    final JComboBox markColor = new JComboBox(MarkerColors.values());
    markFound.setSelected(configuration.getBoolean("gui.markFound", true));
    markFound.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            boolean selected = markFound.isSelected();
            searchActionForward.setMarkFound(selected);
            searchActionBackward.setMarkFound(selected);
            configuration.setProperty("gui.markFound", markFound.isSelected());
        }
    });
    markColor.setRenderer(new MarkerColorsComboBoxRenderer());
    //      markColor.addActionListener(new ActionListener() {
    //
    //         @Override
    //         public void actionPerformed(ActionEvent e) {
    //            MarkerColors markerColors = (MarkerColors) markColor.getSelectedItem();
    //            searchActionForward.setMarkerColors(markerColors);
    //            searchActionBackward.setMarkerColors(markerColors);
    //            markAllFoundAction.setMarkerColors(markerColors);
    //            configuration.setProperty("gui.markColor", markColor.getSelectedItem());
    //            otrosApplication.setSelectedMarkColors(markerColors);
    //         }
    //      });
    markColor.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            MarkerColors markerColors = (MarkerColors) markColor.getSelectedItem();
            searchActionForward.setMarkerColors(markerColors);
            searchActionBackward.setMarkerColors(markerColors);
            markAllFoundAction.setMarkerColors(markerColors);
            configuration.setProperty("gui.markColor", markColor.getSelectedItem());
            otrosApplication.setSelectedMarkColors(markerColors);
        }
    });
    markColor.getModel()
            .setSelectedItem(configuration.get(MarkerColors.class, "gui.markColor", MarkerColors.Aqua));
    buttonSearch = new JButton(searchActionForward);
    buttonSearch.setMnemonic(KeyEvent.VK_N);
    JButton buttonSearchPrev = new JButton(searchActionBackward);
    buttonSearchPrev.setMnemonic(KeyEvent.VK_P);
    enableDisableComponetsForTabs.addComponet(buttonSearch);
    enableDisableComponetsForTabs.addComponet(buttonSearchPrev);
    enableDisableComponetsForTabs.addComponet(searchField);
    enableDisableComponetsForTabs.addComponet(markFound);
    enableDisableComponetsForTabs.addComponet(markAllFoundButton);
    enableDisableComponetsForTabs.addComponet(searchMode);
    enableDisableComponetsForTabs.addComponet(markColor);
    toolBar.add(searchMode);
    toolBar.add(searchField);
    toolBar.add(buttonSearch);
    toolBar.add(buttonSearchPrev);
    toolBar.add(markFound);
    toolBar.add(markAllFoundButton);
    toolBar.add(markColor);
    JButton nextMarked = new JButton(new JumpToMarkedAction(otrosApplication, Direction.FORWARD));
    nextMarked.setToolTipText(nextMarked.getText());
    nextMarked.setText("");
    nextMarked.setMnemonic(KeyEvent.VK_E);
    enableDisableComponetsForTabs.addComponet(nextMarked);
    toolBar.add(nextMarked);
    JButton prevMarked = new JButton(new JumpToMarkedAction(otrosApplication, Direction.BACKWARD));
    prevMarked.setToolTipText(prevMarked.getText());
    prevMarked.setText("");
    prevMarked.setMnemonic(KeyEvent.VK_R);
    enableDisableComponetsForTabs.addComponet(prevMarked);
    toolBar.add(prevMarked);
    enableDisableComponetsForTabs.addComponet(toolBar.add(new SearchByLevel(otrosApplication, 1, Level.INFO)));
    enableDisableComponetsForTabs
            .addComponet(toolBar.add(new SearchByLevel(otrosApplication, 1, Level.WARNING)));
    enableDisableComponetsForTabs
            .addComponet(toolBar.add(new SearchByLevel(otrosApplication, 1, Level.SEVERE)));
    enableDisableComponetsForTabs.addComponet(toolBar.add(new SearchByLevel(otrosApplication, -1, Level.INFO)));
    enableDisableComponetsForTabs
            .addComponet(toolBar.add(new SearchByLevel(otrosApplication, -1, Level.WARNING)));
    enableDisableComponetsForTabs
            .addComponet(toolBar.add(new SearchByLevel(otrosApplication, -1, Level.SEVERE)));
}

From source file:tvbrowser.ui.mainframe.MainFrame.java

/**
 * Adds the keyboard actions for going to the program table with the keyboard.
 *
 *//* w w  w  .  java 2  s  . c  o  m*/
public void addKeyboardAction() {
    mProgramTableScrollPane.deSelectItem();

    // register the global hot keys, so they also work when the main menu is not visible
    for (final TVBrowserAction action : TVBrowserActions.getActions()) {
        KeyStroke keyStroke = action.getAccelerator();
        if (keyStroke != null) {
            rootPane.registerKeyboardAction(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    if (action.isEnabled()) {
                        action.actionPerformed(null);
                    }
                }
            }, keyStroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
        }
    }

    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_MASK);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_UP), stroke,
            JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_KP_UP, InputEvent.CTRL_MASK);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_UP), stroke,
            JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_MASK);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_RIGHT),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, InputEvent.CTRL_MASK);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_RIGHT),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_DOWN),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_KP_DOWN, InputEvent.CTRL_MASK);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_DOWN),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.CTRL_MASK);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_LEFT),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, InputEvent.CTRL_MASK);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_LEFT),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_CONTEXT_MENU, 0, true);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_CONTEXTMENU),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_R, 0, true);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_CONTEXTMENU),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_MASK);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_DESELECT),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_L, 0, true);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_SINGLECLICK),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_D, 0, true);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_DOUBLECLICK),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_M, 0, true);
    rootPane.registerKeyboardAction(new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_MIDDLECLICK),
            stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_O, 0, true);
    rootPane.registerKeyboardAction(
            new KeyboardAction(mProgramTableScrollPane, KeyboardAction.KEY_MIDDLE_DOUBLE_CLICK), stroke,
            JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK);
    rootPane.registerKeyboardAction(TVBrowserActions.goToNextDay, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK);
    rootPane.registerKeyboardAction(TVBrowserActions.goToPreviousDay, stroke,
            JComponent.WHEN_IN_FOCUSED_WINDOW);

    // return from full screen using ESCAPE
    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    rootPane.registerKeyboardAction(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (isFullScreenMode()) {
                TVBrowserActions.fullScreen.actionPerformed(null);
            } else {
                mProgramTableScrollPane.getProgramTable().stopAutoScroll();
                mAutoDownloadTimer = -1;
                mLastTimerMinutesAfterMidnight = IOUtilities.getMinutesAfterMidnight();
                TVBrowser.stopAutomaticDownload();
                if (TVBrowserActions.update.isUpdating()) {
                    TVBrowserActions.update.actionPerformed(null);
                }
            }
        }

    }, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0);
    rootPane.registerKeyboardAction(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            goToLeftSide();
        }

    }, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_END, 0);
    rootPane.registerKeyboardAction(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            goToRightSide();
        }

    }, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK);
    rootPane.registerKeyboardAction(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            mProgramTableScrollPane.scrollPageRight();
        }
    }, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    stroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK);
    rootPane.registerKeyboardAction(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            mProgramTableScrollPane.scrollPageLeft();
        }
    }, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    this.setRootPane(rootPane);
}

From source file:GUI.MainWindow.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./*  w  w  w.  j  a  v a2  s  .co  m*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    ImportScanScreen = new javax.swing.JDialog();
    jLabel1 = new javax.swing.JLabel();
    jScrollPane2 = new javax.swing.JScrollPane();
    ImportFile = new javax.swing.JList();
    jLabel2 = new javax.swing.JLabel();
    FileType = new javax.swing.JTextField();
    jLabel3 = new javax.swing.JLabel();
    FileSize = new javax.swing.JTextField();
    ProgressBar = new javax.swing.JProgressBar();
    VulnTreeContextMenu = new javax.swing.JPopupMenu();
    MergeButton = new javax.swing.JMenuItem();
    LookupCVE = new javax.swing.JMenuItem();
    AddToPersonalVulns = new javax.swing.JMenuItem();
    ClearHash = new javax.swing.JMenuItem();
    jSeparator1 = new javax.swing.JPopupMenu.Separator();
    DeleteButton = new javax.swing.JMenuItem();
    VulnAffectedHostsContextMenu = new javax.swing.JPopupMenu();
    AddHostsButton = new javax.swing.JMenuItem();
    EditHostname = new javax.swing.JMenuItem();
    jSeparator2 = new javax.swing.JPopupMenu.Separator();
    DeleteHost = new javax.swing.JMenuItem();
    VulnReferencesContextMenu = new javax.swing.JPopupMenu();
    InsertReference = new javax.swing.JMenuItem();
    EditReferenceOption = new javax.swing.JMenuItem();
    LaunchInBrowser = new javax.swing.JMenuItem();
    jSeparator3 = new javax.swing.JPopupMenu.Separator();
    DeleteReferenceOption = new javax.swing.JMenuItem();
    ManageAffectedHosts = new javax.swing.JDialog();
    jScrollPane5 = new javax.swing.JScrollPane();
    ListOfHosts = new javax.swing.JList();
    jScrollPane9 = new javax.swing.JScrollPane();
    ListOfOpenPorts = new javax.swing.JList();
    jLabel5 = new javax.swing.JLabel();
    jLabel13 = new javax.swing.JLabel();
    MainScreenBottomPanel = new javax.swing.JPanel();
    jLabel20 = new javax.swing.JLabel();
    VulnTreeFilter = new javax.swing.JTextField();
    ExtraInfoLabel = new javax.swing.JLabel();
    jSplitPane2 = new javax.swing.JSplitPane();
    ViewModeTabPane = new javax.swing.JTabbedPane();
    jScrollPane1 = new javax.swing.JScrollPane();
    VulnTree = new javax.swing.JTree();
    jScrollPane3 = new javax.swing.JScrollPane();
    HostTree = new javax.swing.JTree();
    RightPanelCardLayout = new javax.swing.JPanel();
    RightPanelVulnView = new javax.swing.JPanel();
    VulnerabilityTopPanel = new javax.swing.JPanel();
    jPanel8 = new javax.swing.JPanel();
    jLabel9 = new javax.swing.JLabel();
    VulnTitleTextField = new javax.swing.JTextField();
    jPanel9 = new javax.swing.JPanel();
    jLabel10 = new javax.swing.JLabel();
    VulnCVSSVectorTextField = new javax.swing.JTextField();
    jLabel11 = new javax.swing.JLabel();
    VulnRiskCategory = new javax.swing.JTextField();
    jLabel12 = new javax.swing.JLabel();
    VulnScore = new javax.swing.JTextField();
    EditRiskButton = new javax.swing.JButton();
    jSplitPane1 = new javax.swing.JSplitPane();
    jSplitPane3 = new javax.swing.JSplitPane();
    VulnRecommendationsPanel = new javax.swing.JPanel();
    jLabel8 = new javax.swing.JLabel();
    jScrollPane7 = new javax.swing.JScrollPane();
    VulnRecommendationTextPane = new javax.swing.JTextPane();
    jSplitPane4 = new javax.swing.JSplitPane();
    VulnReferencesPanel = new javax.swing.JPanel();
    jLabel4 = new javax.swing.JLabel();
    jLabel7 = new javax.swing.JLabel();
    jScrollPane6 = new javax.swing.JScrollPane();
    VulnReferencesList = new javax.swing.JList();
    jScrollPane4 = new javax.swing.JScrollPane();
    VulnAffectedHostsTable = new javax.swing.JTable();
    VulnDescriptionPanel = new javax.swing.JPanel();
    jLabel6 = new javax.swing.JLabel();
    jScrollPane8 = new javax.swing.JScrollPane();
    VulnDescriptionTextPane = new javax.swing.JTextPane();
    RightPanelHostsView = new javax.swing.JPanel();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem3 = new javax.swing.JMenuItem();
    jMenuItem4 = new javax.swing.JMenuItem();
    jMenuItem5 = new javax.swing.JMenuItem();
    jMenuItem11 = new javax.swing.JMenuItem();
    exitButton = new javax.swing.JMenuItem();
    jMenu2 = new javax.swing.JMenu();
    jMenuItem1 = new javax.swing.JMenuItem();
    jMenuItem2 = new javax.swing.JMenuItem();
    jMenuItem7 = new javax.swing.JMenuItem();
    jMenuItem10 = new javax.swing.JMenuItem();
    jMenu4 = new javax.swing.JMenu();
    jMenuItem9 = new javax.swing.JMenuItem();
    jMenu3 = new javax.swing.JMenu();
    jMenuItem8 = new javax.swing.JMenuItem();
    jMenu5 = new javax.swing.JMenu();
    increaseFont = new javax.swing.JMenuItem();
    decreaseFont = new javax.swing.JMenuItem();

    ImportScanScreen.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    ImportScanScreen.setTitle("Report Compiler - Import Scan Screen");
    ImportScanScreen.setMinimumSize(new java.awt.Dimension(382, 220));
    ImportScanScreen.setModal(true);
    ImportScanScreen.addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowActivated(java.awt.event.WindowEvent evt) {
            ImportScanScreenWindowActivated(evt);
        }
    });

    jLabel1.setText("File Name:");

    ImportFile.setModel(new javax.swing.AbstractListModel() {
        String[] strings = { "One" };

        public int getSize() {
            return strings.length;
        }

        public Object getElementAt(int i) {
            return strings[i];
        }
    });
    ImportFile.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    ImportFile.setEnabled(false);
    jScrollPane2.setViewportView(ImportFile);

    jLabel2.setText("File Type:");

    FileType.setEnabled(false);

    jLabel3.setText("File Size:");

    FileSize.setEnabled(false);

    ProgressBar.setIndeterminate(true);

    javax.swing.GroupLayout ImportScanScreenLayout = new javax.swing.GroupLayout(
            ImportScanScreen.getContentPane());
    ImportScanScreen.getContentPane().setLayout(ImportScanScreenLayout);
    ImportScanScreenLayout
            .setHorizontalGroup(
                    ImportScanScreenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(ImportScanScreenLayout.createSequentialGroup().addGap(10, 10, 10)
                                    .addGroup(ImportScanScreenLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel1)
                                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    330, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel2)
                                            .addComponent(FileType, javax.swing.GroupLayout.PREFERRED_SIZE, 330,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel3)
                                            .addComponent(FileSize, javax.swing.GroupLayout.PREFERRED_SIZE, 330,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(ProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    330, javax.swing.GroupLayout.PREFERRED_SIZE))));
    ImportScanScreenLayout.setVerticalGroup(ImportScanScreenLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ImportScanScreenLayout.createSequentialGroup().addGap(10, 10, 10).addComponent(jLabel1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 24,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel2)
                    .addGap(6, 6, 6)
                    .addComponent(FileType, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0).addComponent(jLabel3).addGap(6, 6, 6)
                    .addComponent(FileSize, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(10, 10, 10).addComponent(ProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)));

    MergeButton.setText("Merge");
    MergeButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            MergeButtonActionPerformed(evt);
        }
    });
    VulnTreeContextMenu.add(MergeButton);

    LookupCVE.setText("Lookup CVE(s)");
    LookupCVE.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            LookupCVEActionPerformed(evt);
        }
    });
    VulnTreeContextMenu.add(LookupCVE);

    AddToPersonalVulns.setText("Add to Personal Vulns");
    AddToPersonalVulns.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            AddToPersonalVulnsActionPerformed(evt);
        }
    });
    VulnTreeContextMenu.add(AddToPersonalVulns);

    ClearHash.setText("Clear Hash(s)");
    ClearHash.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ClearHashActionPerformed(evt);
        }
    });
    VulnTreeContextMenu.add(ClearHash);
    VulnTreeContextMenu.add(jSeparator1);

    DeleteButton.setText("Delete");
    DeleteButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            DeleteButtonActionPerformed(evt);
        }
    });
    VulnTreeContextMenu.add(DeleteButton);

    VulnAffectedHostsContextMenu.setMinimumSize(new java.awt.Dimension(20, 20));

    AddHostsButton.setText("Add Host");
    AddHostsButton.setActionCommand("AddHost");
    AddHostsButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            AddHostsButtonActionPerformed(evt);
        }
    });
    VulnAffectedHostsContextMenu.add(AddHostsButton);

    EditHostname.setText("Edit Hostname");
    EditHostname.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            EditHostnameActionPerformed(evt);
        }
    });
    VulnAffectedHostsContextMenu.add(EditHostname);
    VulnAffectedHostsContextMenu.add(jSeparator2);

    DeleteHost.setText("Delete Host ('del' is hotkey)");
    DeleteHost.setActionCommand("DeleteHost");
    DeleteHost.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            DeleteHostActionPerformed(evt);
        }
    });
    VulnAffectedHostsContextMenu.add(DeleteHost);

    InsertReference.setText("Insert Reference");
    InsertReference.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            InsertReferenceActionPerformed(evt);
        }
    });
    VulnReferencesContextMenu.add(InsertReference);

    EditReferenceOption.setText("Edit Reference");
    EditReferenceOption.setToolTipText("");
    EditReferenceOption.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            EditReferenceOptionActionPerformed(evt);
        }
    });
    VulnReferencesContextMenu.add(EditReferenceOption);

    LaunchInBrowser.setText("Launch in Browser");
    LaunchInBrowser.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            LaunchInBrowserActionPerformed(evt);
        }
    });
    VulnReferencesContextMenu.add(LaunchInBrowser);
    VulnReferencesContextMenu.add(jSeparator3);

    DeleteReferenceOption.setText("Delete Reference");
    DeleteReferenceOption.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            DeleteReferenceOptionActionPerformed(evt);
        }
    });
    VulnReferencesContextMenu.add(DeleteReferenceOption);

    ManageAffectedHosts.setTitle("Report Compiler - Manage Affected Hosts");
    ManageAffectedHosts.addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowOpened(java.awt.event.WindowEvent evt) {
            ManageAffectedHostsWindowOpened(evt);
        }
    });

    jScrollPane5.setViewportView(ListOfHosts);

    jScrollPane9.setViewportView(ListOfOpenPorts);

    jLabel5.setText("Hosts");

    jLabel13.setText("Ports");

    javax.swing.GroupLayout ManageAffectedHostsLayout = new javax.swing.GroupLayout(
            ManageAffectedHosts.getContentPane());
    ManageAffectedHosts.getContentPane().setLayout(ManageAffectedHostsLayout);
    ManageAffectedHostsLayout.setHorizontalGroup(
            ManageAffectedHostsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ManageAffectedHostsLayout.createSequentialGroup().addGap(25, 25, 25)
                            .addGroup(ManageAffectedHostsLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 180,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel5))
                            .addGap(18, 18, 18)
                            .addGroup(ManageAffectedHostsLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel13).addComponent(jScrollPane9,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 213,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    ManageAffectedHostsLayout.setVerticalGroup(
            ManageAffectedHostsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ManageAffectedHostsLayout.createSequentialGroup().addContainerGap()
                            .addGroup(ManageAffectedHostsLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel5).addComponent(jLabel13))
                            .addGap(13, 13, 13)
                            .addGroup(ManageAffectedHostsLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 291,
                                            Short.MAX_VALUE)
                                    .addComponent(jScrollPane9))
                            .addContainerGap(36, Short.MAX_VALUE)));

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Report Compiler - Main Window");
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });

    jLabel20.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    jLabel20.setText("Tree Filter:");

    VulnTreeFilter.addCaretListener(new javax.swing.event.CaretListener() {
        public void caretUpdate(javax.swing.event.CaretEvent evt) {
            VulnTreeFilterCaretUpdate(evt);
        }
    });

    ExtraInfoLabel.setFont(
            ExtraInfoLabel.getFont().deriveFont(ExtraInfoLabel.getFont().getStyle() | java.awt.Font.BOLD));
    ExtraInfoLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

    javax.swing.GroupLayout MainScreenBottomPanelLayout = new javax.swing.GroupLayout(MainScreenBottomPanel);
    MainScreenBottomPanel.setLayout(MainScreenBottomPanelLayout);
    MainScreenBottomPanelLayout.setHorizontalGroup(MainScreenBottomPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MainScreenBottomPanelLayout.createSequentialGroup().addContainerGap()
                    .addComponent(jLabel20)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(VulnTreeFilter, javax.swing.GroupLayout.PREFERRED_SIZE, 174,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 354, Short.MAX_VALUE)
                    .addComponent(ExtraInfoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 556,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    MainScreenBottomPanelLayout.setVerticalGroup(MainScreenBottomPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MainScreenBottomPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(MainScreenBottomPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(MainScreenBottomPanelLayout.createSequentialGroup()
                                    .addComponent(ExtraInfoLabel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addGap(20, 20, 20))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                    MainScreenBottomPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel20).addComponent(VulnTreeFilter,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    getContentPane().add(MainScreenBottomPanel, java.awt.BorderLayout.SOUTH);

    jSplitPane2.setDividerLocation(200);
    jSplitPane2.setDividerSize(20);
    jSplitPane2.setOneTouchExpandable(true);

    ViewModeTabPane.addChangeListener(new javax.swing.event.ChangeListener() {
        public void stateChanged(javax.swing.event.ChangeEvent evt) {
            ViewModeTabPaneStateChanged(evt);
        }
    });

    javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode(
            "NOT IMPLEMENTED");
    VulnTree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
    VulnTree.setCellRenderer(new VulnerabilityViewTreeCellRenderer(true));
    VulnTree.setRootVisible(false);
    VulnTree.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            VulnTreeMouseClicked(evt);
        }
    });
    VulnTree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
        public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
            VulnTreeValueChanged(evt);
        }
    });
    VulnTree.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            VulnTreeKeyPressed(evt);
        }
    });
    jScrollPane1.setViewportView(VulnTree);

    ViewModeTabPane.addTab("Vuln View", jScrollPane1);

    jScrollPane3.setEnabled(false);

    treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("root");
    HostTree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
    HostTree.setRootVisible(false);
    jScrollPane3.setViewportView(HostTree);

    ViewModeTabPane.addTab("Host View", jScrollPane3);

    jSplitPane2.setLeftComponent(ViewModeTabPane);

    RightPanelCardLayout.setLayout(new java.awt.CardLayout());

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

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

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

    jLabel9.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    jLabel9.setLabelFor(VulnTitleTextField);
    jLabel9.setText("Title: ");
    jPanel8.add(jLabel9);

    VulnTitleTextField.setColumns(80);
    jPanel8.add(VulnTitleTextField);

    VulnerabilityTopPanel.add(jPanel8, java.awt.BorderLayout.NORTH);

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

    jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jLabel10.setText("CVSS:");
    jPanel9.add(jLabel10);

    VulnCVSSVectorTextField.setEditable(false);
    VulnCVSSVectorTextField.setColumns(81);
    jPanel9.add(VulnCVSSVectorTextField);

    jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jLabel11.setText("Category:");
    jPanel9.add(jLabel11);

    VulnRiskCategory.setEditable(false);
    VulnRiskCategory.setColumns(8);
    jPanel9.add(VulnRiskCategory);

    jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
    jLabel12.setText("Score:");
    jPanel9.add(jLabel12);

    VulnScore.setEditable(false);
    VulnScore.setColumns(4);
    jPanel9.add(VulnScore);

    EditRiskButton.setText("Edit Risk");
    EditRiskButton.setToolTipText("Click here to see the Risk Calculator where scores can be modified");
    EditRiskButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            EditRiskButtonActionPerformed(evt);
        }
    });
    jPanel9.add(EditRiskButton);

    VulnerabilityTopPanel.add(jPanel9, java.awt.BorderLayout.CENTER);

    RightPanelVulnView.add(VulnerabilityTopPanel, java.awt.BorderLayout.NORTH);

    jSplitPane1.setDividerLocation(200);
    jSplitPane1.setDividerSize(20);
    jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
    jSplitPane1.setOneTouchExpandable(true);

    jSplitPane3.setDividerLocation(200);
    jSplitPane3.setDividerSize(20);
    jSplitPane3.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
    jSplitPane3.setOneTouchExpandable(true);

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

    jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    jLabel8.setText("Recommendation");
    VulnRecommendationsPanel.add(jLabel8, java.awt.BorderLayout.PAGE_START);

    jScrollPane7.setViewportView(VulnRecommendationTextPane);

    VulnRecommendationsPanel.add(jScrollPane7, java.awt.BorderLayout.CENTER);

    jSplitPane3.setLeftComponent(VulnRecommendationsPanel);

    jSplitPane4.setDividerSize(20);
    jSplitPane4.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
    jSplitPane4.setOneTouchExpandable(true);

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

    jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    jLabel4.setText("Affected Hosts");
    VulnReferencesPanel.add(jLabel4, java.awt.BorderLayout.PAGE_END);

    jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    jLabel7.setText("References");
    VulnReferencesPanel.add(jLabel7, java.awt.BorderLayout.PAGE_START);

    VulnReferencesList.setModel(new DefaultListModel());
    VulnReferencesList.setToolTipText("Right click on this area to see options for references.");
    VulnReferencesList.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            VulnReferencesListMouseClicked(evt);
        }
    });
    VulnReferencesList.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            VulnReferencesListKeyPressed(evt);
        }
    });
    jScrollPane6.setViewportView(VulnReferencesList);

    VulnReferencesPanel.add(jScrollPane6, java.awt.BorderLayout.CENTER);

    jSplitPane4.setTopComponent(VulnReferencesPanel);

    jScrollPane4.setToolTipText(
            "Right click on this area to insert new affected hosts. Select one or more and press 'del' to delete or use the right click 'delete' option.");
    jScrollPane4.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jScrollPane4MouseClicked(evt);
        }
    });
    jScrollPane4.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            jScrollPane4KeyPressed(evt);
        }
    });

    VulnAffectedHostsTable.setAutoCreateRowSorter(true);
    VulnAffectedHostsTable.setModel(new AffectedHostsTableModel());

    /*new javax.swing.table.DefaultTableModel(
    new Object[][]{},
    new String[]{
        "IP Address", "Hostname", "Portnumber", "Protocol"
    }
    ) {
    Class[] types = new Class[]{
        Host.class, java.lang.String.class, java.lang.Integer.class, java.lang.String.class
    };
            
    public Class getColumnClass(int columnIndex) {
        return types[columnIndex];
    }
    }*///);
    VulnAffectedHostsTable.setToolTipText("");
    VulnAffectedHostsTable.setCellSelectionEnabled(true);
    VulnAffectedHostsTable.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            VulnAffectedHostsTableMouseClicked(evt);
        }
    });
    VulnAffectedHostsTable.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            VulnAffectedHostsTableKeyPressed(evt);
        }
    });
    jScrollPane4.setViewportView(VulnAffectedHostsTable);
    VulnAffectedHostsTable.getColumnModel().getSelectionModel()
            .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION);

    jSplitPane4.setRightComponent(jScrollPane4);

    jSplitPane3.setRightComponent(jSplitPane4);

    jSplitPane1.setBottomComponent(jSplitPane3);

    VulnDescriptionPanel.setMinimumSize(new java.awt.Dimension(0, 50));
    VulnDescriptionPanel.setLayout(new java.awt.BorderLayout());

    jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
    jLabel6.setText("Description");
    VulnDescriptionPanel.add(jLabel6, java.awt.BorderLayout.PAGE_START);

    jScrollPane8.setViewportView(VulnDescriptionTextPane);

    VulnDescriptionPanel.add(jScrollPane8, java.awt.BorderLayout.CENTER);

    jSplitPane1.setTopComponent(VulnDescriptionPanel);

    RightPanelVulnView.add(jSplitPane1, java.awt.BorderLayout.CENTER);

    RightPanelCardLayout.add(RightPanelVulnView, "vulnView");

    javax.swing.GroupLayout RightPanelHostsViewLayout = new javax.swing.GroupLayout(RightPanelHostsView);
    RightPanelHostsView.setLayout(RightPanelHostsViewLayout);
    RightPanelHostsViewLayout.setHorizontalGroup(RightPanelHostsViewLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 1103, Short.MAX_VALUE));
    RightPanelHostsViewLayout.setVerticalGroup(RightPanelHostsViewLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 739, Short.MAX_VALUE));

    RightPanelCardLayout.add(RightPanelHostsView, "hostView");

    jSplitPane2.setRightComponent(RightPanelCardLayout);

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

    jMenu1.setMnemonic('F');
    jMenu1.setText("File");

    jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N,
            java.awt.event.InputEvent.CTRL_MASK));
    jMenuItem3.setText("New (Clear Tree)");
    jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem3ActionPerformed(evt);
        }
    });
    jMenu1.add(jMenuItem3);

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

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

    jMenuItem11.setText("Save As");
    jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem11ActionPerformed(evt);
        }
    });
    jMenu1.add(jMenuItem11);

    exitButton.setText("Exit");
    exitButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exitButtonActionPerformed(evt);
        }
    });
    jMenu1.add(exitButton);

    jMenuBar1.add(jMenu1);

    jMenu2.setMnemonic('V');
    jMenu2.setText("Vulnerabilities");
    jMenu2.setToolTipText(
            "All vulnerability related operations. Import from a tool, create an entirely new one etc");

    jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    jMenuItem1.setText("Import from Tool");
    jMenuItem1.setToolTipText("Select one or more files to import simultaneously. ");
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem1ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem1);

    jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_INSERT,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    jMenuItem2.setText("Create New Vulnerability");
    jMenuItem2.setToolTipText(
            "Add a new vulnerability to your test. When finished you can save it to your Personal Vulnerability database by right clicking on the issue in the tree");
    jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem2ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem2);

    jMenuItem7.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    jMenuItem7.setText("Manage Personal Vulns");
    jMenuItem7.setToolTipText(
            "Allows you to delete or edit the text for vulnerabilities in your Personal Database");
    jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem7ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem7);

    jMenuItem10.setText("Auto Merge");
    jMenuItem10.setToolTipText(
            "Use this to automatically replace the title, description, recommendation, references, and risk score with vulnerabilities in your personal database.");
    jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem10ActionPerformed(evt);
        }
    });
    jMenu2.add(jMenuItem10);

    jMenuBar1.add(jMenu2);

    jMenu4.setText("Hosts");

    jMenuItem9.setText("Import Hosts by Nmap");
    jMenuItem9.setEnabled(false);
    jMenu4.add(jMenuItem9);

    jMenuBar1.add(jMenu4);

    jMenu3.setMnemonic('E');
    jMenu3.setText("Export");

    jMenuItem8.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    jMenuItem8.setText("Excel Vulnerability List");
    jMenuItem8.setToolTipText(
            "This can be used to send a high level debrief to clients in a spreadsheet format. Report Compiler also imports vulnerabilities back from these excel files if necessary.");
    jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem8ActionPerformed(evt);
        }
    });
    jMenu3.add(jMenuItem8);

    jMenuBar1.add(jMenu3);

    jMenu5.setText("Options");

    increaseFont.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_EQUALS,
            java.awt.event.InputEvent.CTRL_MASK));
    increaseFont.setText("Increase Font");
    increaseFont.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            increaseFontActionPerformed(evt);
        }
    });
    jMenu5.add(increaseFont);

    decreaseFont.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_MINUS,
            java.awt.event.InputEvent.CTRL_MASK));
    decreaseFont.setText("Decrease Font");
    decreaseFont.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            decreaseFontActionPerformed(evt);
        }
    });
    jMenu5.add(decreaseFont);

    jMenuBar1.add(jMenu5);

    setJMenuBar(jMenuBar1);

    pack();
    setLocationRelativeTo(null);
}

From source file:com.opendoorlogistics.studio.AppFrame.java

@SuppressWarnings("serial")
private List<MyAction> initFileActions() {
    ArrayList<MyAction> ret = new ArrayList<>();
    ret.add(new MyAction("New", "Create new file", null, "document-new-6.png", false,
            KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK)) {

        @Override// w  ww.j av  a 2 s .  c  om
        public void actionPerformed(ActionEvent e) {
            createNewDatastore();
        }
    });

    ret.add(new MyAction("Open", "Open file", null, "document-open-3.png", false,
            KeyStroke.getKeyStroke(KeyEvent.VK_O, java.awt.Event.CTRL_MASK)) {

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

    ret.add(null);

    ret.add(new MyAction("Close", "Close file", null, "document-close-4.png", true,
            KeyStroke.getKeyStroke(KeyEvent.VK_W, java.awt.Event.CTRL_MASK)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (!canCloseDatastore()) {
                return;
            }
            closeDatastore();
        }
    });

    ret.add(null);

    ret.add(new MyAction("Save", "Save file", null, "document-save-2.png", true,
            KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            saveDatastoreWithoutUserPrompt(loaded.getLastFile());
        }

        @Override
        public void updateEnabled() {

            setEnabled(loaded != null && loaded.getLastFile() != null);
        }

    });
    ret.add(new MyAction("Save as", "Save file as", null, "document-save-as-2.png", true,
            KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK | Event.ALT_MASK)) {

        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = SupportedFileType.EXCEL.createFileChooser();
            if (loaded.getLastFile() != null) {
                chooser.setSelectedFile(loaded.getLastFile());
            } else {
                File file = PreferencesManager.getSingleton().getFile(PrefKey.LAST_IO_DIR);
                IOUtils.setFile(file, chooser);
            }
            if (chooser.showSaveDialog(AppFrame.this) == JFileChooser.APPROVE_OPTION) {
                saveDatastoreWithoutUserPrompt(chooser.getSelectedFile());
            }

        }
    });

    return ret;
}

From source file:corelyzer.ui.CorelyzerApp.java

private void setupMenuStuff() {
    menuBar = new JMenuBar();

    // Create File Menu
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);

    JMenuItem createSessionMenuItem = new JMenuItem("Create a Session", KeyEvent.VK_N);
    createSessionMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, MENU_MASK));
    createSessionMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.createSession();//from www  .  ja  v  a  2  s .  c  o  m
        }
    });
    createSessionMenuItem.setEnabled(true);
    fileMenu.add(createSessionMenuItem);

    createTrackMenuItem = new JMenuItem("Create a Track", KeyEvent.VK_T);
    createTrackMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, MENU_MASK));
    createTrackMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.createTrack();
        }
    });
    createTrackMenuItem.setEnabled(false);
    fileMenu.add(createTrackMenuItem);

    fileMenu.addSeparator();

    // Images
    JMenu loadImageMenu = new JMenu("Load Images");
    loadImageMenuItem = new JMenuItem("Open Local Image Files...", KeyEvent.VK_M);
    loadImageMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, MENU_MASK));
    loadImageMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.loadImageAction();
        }
    });
    loadImageMenu.add(loadImageMenuItem);

    // "Auto-load" 4/25/2012 brg
    JMenuItem autoLoadImageMenuItem = new JMenuItem("Open Image Listing...");
    autoLoadImageMenuItem.setEnabled(true);
    autoLoadImageMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.loadImageListingAction();
        }
    });
    loadImageMenu.add(autoLoadImageMenuItem);

    // online image services
    JMenuItem chronosMenuItem = new JMenuItem("Online Image Services...");
    loadImageMenu.add(chronosMenuItem);
    chronosMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            IODPListsDialog d = new IODPListsDialog(getMainFrame());
            d.pack();
            d.setSize(800, 600);
            d.setLocationRelativeTo(getMainFrame());
            d.setVisibleTab(1);
            d.setVisible(true);
        }
    });

    fileMenu.add(loadImageMenu);

    // Numbercal data (plots)
    JMenu loadDataMenu = new JMenu("Load Data");

    loadDataMenuItem = new JMenuItem("Open Local Dataset Files", KeyEvent.VK_D);
    loadDataMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, MENU_MASK));
    loadDataMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            Runnable r = new Runnable() {
                public void run() {
                    controller.loadData();
                }
            };

            new Thread(r).start();
        }
    });
    loadDataMenu.add(loadDataMenuItem);
    fileMenu.add(loadDataMenu);

    JMenuItem quickDataImportMenuItem = new JMenuItem("Quick Data Import...");
    quickDataImportMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.quickDataImport();
        }
    });
    loadDataMenu.add(quickDataImportMenuItem);

    JMenuItem importDataMenuItem = new JMenuItem("Custom Data Import...");
    importDataMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.importData();
        }
    });
    loadDataMenu.add(importDataMenuItem);

    // LoggingDB
    JMenuItem loggingDBMenuItem = new JMenuItem("LDEO logging DB...");
    loggingDBMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            IODPListsDialog d = new IODPListsDialog(getMainFrame());
            d.pack();
            d.setSize(800, 600);
            d.setLocationRelativeTo(getMainFrame());
            d.setVisibleTab(2);
            d.setVisible(true);
        }
    });
    loadDataMenu.add(loggingDBMenuItem);

    fileMenu.addSeparator();

    loadStateFileMenuItem = new JMenuItem("Open a Session File", KeyEvent.VK_O);
    loadStateFileMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, MENU_MASK));
    loadStateFileMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.loadStateFile();
        }
    });
    loadStateFileMenuItem.setEnabled(false);
    fileMenu.add(loadStateFileMenuItem);

    JMenuItem saveMenuItem = new JMenuItem("Save Session", KeyEvent.VK_S);
    saveMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, MENU_MASK));
    saveMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            controller.saveCurrentSession();
        }
    });
    fileMenu.add(saveMenuItem);

    JMenuItem saveStateToFileMenuItem = new JMenuItem("Save Session As...", KeyEvent.VK_S);
    saveStateToFileMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, MENU_MASK));
    saveStateToFileMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.saveStateToFile();
        }
    });
    fileMenu.add(saveStateToFileMenuItem);

    // Session History
    recentSessionsMenu = new JMenu("Recent Sessions");
    controller.refreshSessionHistoryMenu();
    fileMenu.add(recentSessionsMenu);

    fileMenu.addSeparator();

    JMenu packageMenu = new JMenu("Core Archive");
    JMenuItem importMenuItem = new JMenuItem("Import...");
    importMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.importPackage();
        }
    });
    packageMenu.add(importMenuItem);

    JMenuItem exportMenuItem = new JMenuItem("Export...");
    exportMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.exportTheWholeScene();
        }
    });
    packageMenu.add(exportMenuItem);
    fileMenu.add(packageMenu);

    JMenu limsMenu = new JMenu("IODP");

    JMenuItem allIODPLists = new JMenuItem("All IODP lists...");
    allIODPLists.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            IODPListsDialog d = new IODPListsDialog(getMainFrame());
            d.pack();
            d.setSize(800, 600);
            d.setLocationRelativeTo(getMainFrame());
            d.setVisible(true);
        }
    });
    limsMenu.add(allIODPLists);

    JMenuItem loadLIMSTables = new JMenuItem("Load a section list...");
    loadLIMSTables.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            IODPListsDialog d = new IODPListsDialog(getMainFrame());
            d.loadLIMSTables(getMainFrame());

            d.pack();
            d.setSize(800, 600);
            d.setLocationRelativeTo(getMainFrame());
            d.setVisibleTab(0);
            d.setVisible(true);
        }
    });
    limsMenu.add(loadLIMSTables);

    JMenuItem loadAffineTable = new JMenuItem("Load an affine table...");
    loadAffineTable.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            IODPListsDialog d = new IODPListsDialog(getMainFrame());
            d.loadAAffineTable(getMainFrame());

            d.pack();
            d.setSize(800, 600);
            d.setLocationRelativeTo(getMainFrame());
            d.setVisibleTab(3);
            d.setVisible(true);
        }
    });
    limsMenu.add(loadAffineTable);

    JMenuItem loadSpliceTable = new JMenuItem("Load a splice table...");
    loadSpliceTable.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            IODPListsDialog d = new IODPListsDialog(getMainFrame());
            d.loadASpliceTable(getMainFrame());

            d.pack();
            d.setSize(800, 600);
            d.setLocationRelativeTo(getMainFrame());
            d.setVisibleTab(4);
            d.setVisible(true);
        }
    });
    limsMenu.add(loadSpliceTable);

    fileMenu.add(limsMenu);

    JMenu disMenu = new JMenu("DIS");

    JMenuItem disListMenuItem = new JMenuItem("Accessing DIS...");
    disListMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            DISListsDialog d = new DISListsDialog(getMainFrame());
            d.pack();
            d.setSize(800, 600);
            d.setLocationRelativeTo(getMainFrame());
            d.setVisible(true);
        }
    });

    JMenuItem disImport = new JMenuItem("Import...");
    disImport.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.disImport();
        }
    });
    JMenuItem disExport = new JMenuItem("Export...");
    disExport.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.disExport();
        }
    });

    JMenuItem disBatchDataLoad = new JMenuItem("Load Tab Delimited Data File...");
    disBatchDataLoad.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.disBatchDataLoad();
        }
    });

    disMenu.add(disListMenuItem);
    disMenu.add(disImport);
    disMenu.add(disExport);
    disMenu.add(disBatchDataLoad);
    fileMenu.add(disMenu);

    JMenuItem saveOutputToFileMenuItem = new JMenuItem("Export Sheets...", KeyEvent.VK_A);
    saveOutputToFileMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.saveOutputToFile();
        }
    });
    fileMenu.add(saveOutputToFileMenuItem);

    fileMenu.addSeparator();

    JMenuItem quitMenuItem = new JMenuItem("Quit");
    fileMenu.add(quitMenuItem);
    quitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, MENU_MASK));
    quitMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.quit();
        }
    });

    menuBar.add(fileMenu);

    // Create Edit Menu
    JMenu editMenu = new JMenu("Edit");
    editMenu.setMnemonic(KeyEvent.VK_E);

    JMenuItem clearImageCacheMenuItem = new JMenuItem("Clear Image Cache...", KeyEvent.VK_I);
    clearImageCacheMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.clearImageCache();
        }
    });
    editMenu.add(clearImageCacheMenuItem);

    editMenu.addSeparator();
    JMenuItem depthDirection = new JMenuItem("Switch Depth Direction", KeyEvent.VK_K);
    depthDirection.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, MENU_MASK));
    depthDirection.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            boolean b = SceneGraph.getDepthOrientation();
            SceneGraph.setDepthOrientation(!b);

            CorelyzerApp.getApp().updateGLWindows();
        }
    });
    editMenu.add(depthDirection);

    JMenuItem tour = new JMenuItem("Tour...");
    tour.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            CRNavigationSetupDialog dlg = new CRNavigationSetupDialog();
            dlg.pack();
            dlg.setLocationRelativeTo(getApp().getMainFrame());

            dlg.setAlwaysOnTop(true);
            dlg.setVisible(true);
        }
    });

    editMenu.add(tour);

    editMenu.addSeparator();
    JMenuItem preferencesMenuItem = new JMenuItem("Preferences...");
    editMenu.add(preferencesMenuItem);
    preferencesMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.doPreferences();
        }
    });

    menuBar.add(editMenu);

    // Create Share Menu
    JMenu shareMenu = new JMenu("Share");

    JMenuItem publishMenuItem = new JMenuItem("Publish...");
    publishMenuItem.setEnabled(true);
    publishMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            controller.publishASession();
        }
    });
    shareMenu.add(publishMenuItem);

    JMenuItem listMenuItem = new JMenuItem("List...");
    listMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            controller.listSessions();
        }
    });
    shareMenu.add(listMenuItem);

    shareMenu.addSeparator();

    friendsMenu = new JMenu("Friends");
    shareMenu.add(friendsMenu);

    menuBar.add(shareMenu);

    // Create Debug Menu
    JMenu debugMenu = new JMenu("Debug");
    debugMenu.setMnemonic(KeyEvent.VK_D);

    JMenuItem matchTestMenuItem = new JMenuItem("Match-Test", KeyEvent.VK_B);
    matchTestMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent event) {
            controller.testAndMatch();
        }
    });

    debugMenu.add(matchTestMenuItem);

    if ((System.getenv("DEBUG") != null) && System.getenv("DEBUG").equals("YES")) {
        menuBar.add(shareMenu);
    }

    // Create the Plugin Menu
    pluginMenu = new JMenu("Plugins");
    menuBar.add(pluginMenu);
    pluginMenuItemVec = new Vector<JMenuItem>();

    // Lists
    JMenu listsMenu = new JMenu("Lists");

    JMenuItem iodpLists = new JMenuItem("IODP lists...");
    iodpLists.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            IODPListsDialog d = new IODPListsDialog(getMainFrame());
            d.pack();
            d.setSize(800, 600);
            d.setLocationRelativeTo(getMainFrame());
            d.setVisible(true);
        }
    });
    listsMenu.add(iodpLists);

    JMenuItem disLists = new JMenuItem("DIS lists...");
    disLists.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            DISListsDialog d = new DISListsDialog(getMainFrame());
            d.pack();
            d.setSize(800, 600);
            d.setLocationRelativeTo(getMainFrame());
            d.setVisible(true);
        }
    });
    listsMenu.add(disLists);

    JMenu annotLists = new JMenu("Annotation");

    JMenuItem freeformsItem = new JMenuItem("Default");
    freeformsItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            FreeformAnnotationListDialog dlg = new FreeformAnnotationListDialog(getApp().getMainFrame());
            dlg.pack();
            dlg.setLocationRelativeTo(getApp().getMainFrame());
            dlg.onRefresh();

            dlg.setAlwaysOnTop(true);
            dlg.setVisible(true);
        }
    });
    annotLists.add(freeformsItem);

    JMenuItem clastListItem = new JMenuItem("Clast");
    clastListItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            ClastStatisticsDialog dlg = new ClastStatisticsDialog(getApp().getMainFrame());
            dlg.pack();
            dlg.setLocationRelativeTo(getApp().getMainFrame());
            dlg.onRefresh();

            dlg.setAlwaysOnTop(true);
            dlg.setVisible(true);
        }
    });
    annotLists.add(clastListItem);

    JMenuItem sampleReqsItem = new JMenuItem("Sample");
    sampleReqsItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            SampleRequestListDialog dlg = new SampleRequestListDialog(getApp().getMainFrame());
            dlg.pack();
            dlg.setLocationRelativeTo(getApp().getMainFrame());
            dlg.onRefresh();

            dlg.setAlwaysOnTop(true);
            dlg.setVisible(true);
        }
    });
    annotLists.add(sampleReqsItem);
    listsMenu.add(annotLists);

    menuBar.add(listsMenu);

    // Create Tools Menu
    JMenu toolsMenu = new JMenu("Tools");
    JMenuItem wholeCoreViewerMenuItem = new JMenuItem("Get 3D Whole Core Imagery Viewer...");
    wholeCoreViewerMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            try {
                String app;
                String url = "http://www.evl.uic.edu/cavern/corewall/SciVizCore/";

                if (System.getProperty("os.name").toLowerCase().contains("windows")) {
                    app = "cmd.exe /c explorer " + url;
                    Runtime.getRuntime().exec(app);
                } else {
                    app = "open";
                    String[] cmd = { app, url };
                    Runtime.getRuntime().exec(cmd);
                }
            } catch (IOException ex) {
                System.err.println("IOException in opening SciVizCore link");
            }
        }
    });

    toolsMenu.add(wholeCoreViewerMenuItem);

    // DEBUG
    String debug = System.getProperty("DEBUG");
    if ((debug != null) && System.getProperty("DEBUG").equals("true")) {
        JMenuItem gcItem = new JMenuItem("GC");
        gcItem.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                long mem0 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
                System.out.println("- B4 mem:\t" + mem0 / 1000000.0f);

                int trials = 10000;
                for (int i = 0; i < trials; i++) {
                    updateGLWindows();
                }

                long mem1 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
                System.out.println("- " + trials + " mem:\t" + mem1 / 1000000.0f);

                System.gc();
                System.gc();
                System.gc();

                long mem2 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
                System.out.println("- AferGC mem:\t" + mem2 / 1000000.0f);
            }
        });
        toolsMenu.add(gcItem);
    }

    menuBar.add(toolsMenu);

    // Create Help Menu
    // Create JavaHelp hooks
    File helpSet = new File("help/jhelpset.hs");
    HelpSet hs = null;
    try {
        URL hsURL = helpSet.toURI().toURL();
        hs = new HelpSet(null, hsURL);
    } catch (HelpSetException e) {
        JOptionPane.showMessageDialog(getMainFrame(), "Cannot find help: format error.");
        e.printStackTrace();
    } catch (MalformedURLException e) {
        JOptionPane.showMessageDialog(getMainFrame(), "Cannot find help: malformed URL.");
        e.printStackTrace();
    }

    // Help UI
    JMenu helpMenu = new JMenu("Help");
    JMenuItem helpMenuItem = new JMenuItem("Help", KeyEvent.VK_H);

    if (hs != null) {
        HelpBroker hb = hs.createHelpBroker();
        helpActionListener = new CSH.DisplayHelpFromSource(hb);
        helpMenuItem.addActionListener(helpActionListener);
    } else {
        helpMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(final ActionEvent event) {
                controller.helpAction();
            }
        });
    }
    helpMenu.add(helpMenuItem);

    helpMenu.addSeparator();
    JMenuItem aboutMenuItem = new JMenuItem("About Corelyzer");
    helpMenu.add(aboutMenuItem);
    aboutMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent event) {
            controller.about();
        }
    });

    menuBar.add(helpMenu);

    mainFrame.setJMenuBar(menuBar);
}