Example usage for java.awt.event KeyEvent VK_H

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

Introduction

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

Prototype

int VK_H

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

Click Source Link

Document

Constant for the "H" key.

Usage

From source file:net.sourceforge.entrainer.gui.EntrainerFX.java

private void addMenu() {
    JMenuBar bar = new JMenuBar();

    JMenu menu = new JMenu(FILE_MENU_NAME);
    addMnemonic(menu, KeyEvent.VK_F);

    menu.add(getStartItem());//www . j  a  v  a  2 s .  co m
    menu.add(getStopItem());
    menu.add(new JSeparator());
    menu.add(getLoadXmlItem());
    menu.add(getClearXmlItem());
    menu.add(getEditXmlItem());
    menu.add(getNewXmlItem());
    menu.add(new JSeparator());
    menu.add(getExitItem());
    bar.add(menu);

    bar.add(getLookAndFeels());

    bar.add(intervalMenu);

    bar.add(getEspMenu());

    bar.add(getSocketMenu());

    JMenu help = new JMenu(HELP_MENU_NAME);
    addMnemonic(help, KeyEvent.VK_H);

    help.add(getAboutItem());
    help.add(getLicenseItem());
    help.add(getLocalDocItem());
    help.add(getRemoteDocItem());
    help.add(getSplashItem());
    help.add(getSplashOnStartupItem());
    bar.add(help);

    setJMenuBar(bar);
}

From source file:com.intuit.tank.proxy.ProxyApp.java

/**
 * /* w w w.j  av  a2  s.  co  m*/
 */
@SuppressWarnings("serial")
private void createActions() {

    startAction = new AbstractAction("Start Recording", loadImage("icons/16/control_play_blue.png")) {
        public void actionPerformed(ActionEvent arg0) {
            try {
                start();
            } catch (Exception e) {
                JOptionPane.showMessageDialog(ProxyApp.this, "Error statrting proxy: " + e.toString(), "Error",
                        JOptionPane.ERROR_MESSAGE);
            }
        }

    };
    startAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Start Recording");

    stopAction = new AbstractAction("Stop Recording", loadImage("icons/16/control_stop_blue.png")) {
        public void actionPerformed(ActionEvent arg0) {
            try {
                stop();
            } catch (Exception e) {
                JOptionPane.showMessageDialog(ProxyApp.this, "Error stopping proxy: " + e.toString(), "Error",
                        JOptionPane.ERROR_MESSAGE);
            }
        }

    };
    stopAction.setEnabled(false);
    stopAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Stop Recording");

    pauseAction = new AbstractAction("Pause Recording", loadImage("icons/16/control_pause_blue.png")) {
        public void actionPerformed(ActionEvent arg0) {
            pause();
        }
    };
    pauseAction.setEnabled(false);
    pauseAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Pause Recording");

    settingsAction = new AbstractAction("Settings", loadImage("icons/16/cog.png")) {
        public void actionPerformed(ActionEvent arg0) {
            showSettings();
        }

    };
    settingsAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Settings");

    filterAction = new AbstractAction("Run Filters", loadImage("icons/16/filter.png")) {
        public void actionPerformed(ActionEvent arg0) {
            filter();
        }

    };
    filterAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Run Filters");
    filterAction.setEnabled(false);

    saveAction = new AbstractAction("Save", loadImage("icons/16/save_as.png")) {
        public void actionPerformed(ActionEvent arg0) {
            save();
        }

    };
    saveAction.setEnabled(false);
    saveAction.putValue(javax.swing.Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, keyMask));
    saveAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Save");

    openAction = new AbstractAction("Open Recording...", loadImage("icons/16/folder_go.png")) {
        public void actionPerformed(ActionEvent arg0) {
            openRecording();
        }

    };
    openAction.putValue(javax.swing.Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, keyMask));
    openAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Open Recording...");

    showHostsAction = new AbstractAction("Hosts...", loadImage("icons/16/page_add.png")) {
        public void actionPerformed(ActionEvent arg0) {
            showHosts();
        }

    };
    showHostsAction.putValue(javax.swing.Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_H, keyMask));
    showHostsAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Show Hosts...");

    fileChooser = new JFileChooser(new File("."));
    fileChooser.setDialogTitle("Open Recording...");
    fileChooser.setFileFilter(new XmlFileFilter());
}

From source file:com.pingtel.sipviewer.SIPViewerFrame.java

protected void initMenu() {
    JMenu menu;/*from www .j  av  a2  s. c o  m*/
    JMenu submenu;
    JMenuItem menuItem;
    JRadioButtonMenuItem rbMenuItem;

    // Create the menu bar.
    JMenuBar menuBar = new JMenuBar();
    this.setJMenuBar(menuBar);

    // Build the File menu.
    menu = new JMenu("File");
    menu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(menu);

    // Add the load-file items to the File menu.
    menuItem = new JMenuItem();
    menuItem.setAction(new icOpenFileAction());
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.ALT_MASK));
    menuItem.setMnemonic(KeyEvent.VK_F);
    menu.add(menuItem);

    menuItem = new JMenuItem();
    menuItem.setAction(new icImportSyslogAction());
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, ActionEvent.ALT_MASK));
    menuItem.setMnemonic(KeyEvent.VK_Y);
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem();
    menuItem.setAction(new icSaveAsAction());
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.ALT_MASK));
    menuItem.setMnemonic(KeyEvent.VK_S);
    menu.add(menuItem);

    menu.addSeparator();

    // Add the reload item to the File menu.
    menuItem = new JMenuItem();
    menuItem.setAction(new icReloadAction());
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.ALT_MASK));
    menuItem.setMnemonic(KeyEvent.VK_R);
    menu.add(menuItem);

    menu.addSeparator();

    // Add the quit item to the File menu.
    menuItem = new JMenuItem();
    menuItem.setAction(new icQuitAction());
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK));
    menuItem.setMnemonic(KeyEvent.VK_Q);
    menu.add(menuItem);

    // Build the Options menu.
    menu = new JMenu("Options");
    menu.setMnemonic(KeyEvent.VK_O);
    menuBar.add(menu);

    // Add the split/single screen mode to the options menu
    menuItem = new JMenuItem();
    menuItem.setAction(new icScreenModeAction());
    menuItem.setMnemonic(KeyEvent.VK_M);
    menu.add(menuItem);

    menu.addSeparator();

    // Add the show all dialogs option to the options menu
    menuItem = new JMenuItem();
    menuItem.setAction(new icShowAllDialogsAction());
    menuItem.setMnemonic(KeyEvent.VK_D);
    menu.add(menuItem);

    menu.addSeparator();

    // Add the Time Zone Selection Time submenu
    submenu = new JMenu("Time Zone Setting");
    submenu.setMnemonic(KeyEvent.VK_Z);

    ButtonGroup timeZoneGroup = new ButtonGroup();

    // Set Time Zone to Local Time Zone
    m_localTimeZone = new JRadioButtonMenuItem();
    m_localTimeZone.setAction(new icSetTimeToLocalZone());
    m_localTimeZone.setMnemonic(KeyEvent.VK_L);
    timeZoneGroup.add(m_localTimeZone);
    m_localTimeZone.setSelected(true);
    submenu.add(m_localTimeZone);

    // Set Time Zone to UTC Time Zone
    m_utcTimeZone = new JRadioButtonMenuItem();
    m_utcTimeZone.setAction(new icSetTimeToUTCZone());
    m_utcTimeZone.setMnemonic(KeyEvent.VK_U);
    timeZoneGroup.add(m_utcTimeZone);
    submenu.add(m_utcTimeZone);

    menu.add(submenu);

    // Add the show/hide time index column
    menuItem = new JMenuItem();
    menuItem.setAction(new icTimeVisibilityAction());
    menuItem.setMnemonic(KeyEvent.VK_V);
    menu.add(menuItem);

    // Add the Time Display Format submenu
    submenu = new JMenu("Time Display Format");
    submenu.setMnemonic(KeyEvent.VK_T);

    ButtonGroup group = new ButtonGroup();
    m_dateAndTimeFormat = new JRadioButtonMenuItem();
    m_dateAndTimeFormat.setAction(new icDateAndTimeAction());
    m_dateAndTimeFormat.setMnemonic(KeyEvent.VK_I);
    group.add(m_dateAndTimeFormat);
    submenu.add(m_dateAndTimeFormat);

    m_defaultTimeFormat = new JRadioButtonMenuItem();
    m_defaultTimeFormat.setAction(new icTimeOfDay());
    m_defaultTimeFormat.setMnemonic(KeyEvent.VK_E);
    m_defaultTimeFormat.setSelected(true);
    group.add(m_defaultTimeFormat);
    submenu.add(m_defaultTimeFormat);

    m_sincePreviousFormat = new JRadioButtonMenuItem();
    m_sincePreviousFormat.setAction(new icSincePrevious());
    m_sincePreviousFormat.setMnemonic(KeyEvent.VK_P);
    group.add(m_sincePreviousFormat);
    submenu.add(m_sincePreviousFormat);

    m_sinceBeginningFormat = new JRadioButtonMenuItem();
    m_sinceBeginningFormat.setAction(new icSinceBeginning());
    m_sinceBeginningFormat.setMnemonic(KeyEvent.VK_B);
    group.add(m_sinceBeginningFormat);
    submenu.add(m_sinceBeginningFormat);

    m_sinceKeyIndexFormat = new JRadioButtonMenuItem();
    m_sinceKeyIndexFormat.setAction(new icSinceKeyIndex());
    m_sinceKeyIndexFormat.setMnemonic(KeyEvent.VK_K);
    group.add(m_sinceKeyIndexFormat);
    submenu.add(m_sinceKeyIndexFormat);

    menu.add(submenu);

    // Build the Help menu.
    menu = new JMenu("Help");
    menu.setMnemonic(KeyEvent.VK_H);
    menuBar.add(menu);

    // Add the items to the File menu.
    menuItem = new JMenuItem();
    menuItem.setAction(new icAboutAction());
    menu.add(menuItem);
}

From source file:lejos.pc.charting.LogChartFrame.java

/** All the setup of components, etc. What's scary is Swing is a "lightweight" GUI framework...
 * @throws Exception/*w  w w  .j av  a2s  . c om*/
 */
private void jbInit() throws Exception {
    this.setJMenuBar(menuBar);
    this.setSize(new Dimension(819, 613));
    this.setMinimumSize(new Dimension(819, 613));
    this.setTitle("NXT Charting Logger");
    this.setEnabled(true);
    // enforce minimum window size
    this.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            JFrame theFrame = (JFrame) e.getSource();
            Dimension d1 = theFrame.getMinimumSize();
            Dimension d2 = theFrame.getSize();
            boolean enforce = false;
            if (theFrame.getWidth() < d1.getWidth()) {
                d2.setSize(d1.getWidth(), d2.getHeight());
                enforce = true;
            }
            if (theFrame.getHeight() < d1.getHeight()) {
                d2.setSize(d2.getWidth(), d1.getHeight());
                enforce = true;
            }
            if (enforce)
                theFrame.setSize(d2);
        }
    });

    this.getContentPane().setLayout(gridBagLayout1);
    MenuActionListener menuItemActionListener = new MenuActionListener();
    MenuEventListener menuListener = new MenuEventListener();

    menu = new JMenu("Edit");
    menu.setMnemonic(KeyEvent.VK_E);
    menuBar.add(menu);
    menuItem = new JMenuItem("Copy Chart Image", KeyEvent.VK_I);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);
    menuItem = new JMenuItem("Copy Data Log", KeyEvent.VK_D);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);

    menu = new JMenu("View");
    menu.setMnemonic(KeyEvent.VK_V);
    menu.setActionCommand("VIEW_MENU");
    menu.addMenuListener(menuListener);
    menuBar.add(menu);
    menuItem = new JMenuItem("Expand Chart", KeyEvent.VK_F);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);
    menuItem = new JMenuItem("Chart in New Window", KeyEvent.VK_N);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);

    menu = new JMenu("Help");
    menu.setMnemonic(KeyEvent.VK_H);
    menuBar.add(menu);
    menuItem = new JMenuItem("Chart controls", KeyEvent.VK_C);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);
    menuItem = new JMenuItem("Generate sample data", KeyEvent.VK_G);
    menuItem.addActionListener(menuItemActionListener);
    menu.add(menuItem);
    menuItem = new JMenuItem("About", KeyEvent.VK_A);
    menuItem.addActionListener(menuItemActionListener);
    jTabbedPane1.setPreferredSize(new Dimension(621, 199));
    jTabbedPane1.setMinimumSize(new Dimension(621, 199));
    menu.add(menuItem);

    jButtonConnect.setText("Connect");
    jButtonConnect.setBounds(new Rectangle(25, 65, 115, 25));
    jButtonConnect.setToolTipText("Connect/disconnect toggle");
    jButtonConnect.setMnemonic('C');
    jButtonConnect.setSelected(true);
    jButtonConnect.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jButtonConnect_actionPerformed(e);
        }
    });
    UIPanel.setSize(new Dimension(820, 200));
    UIPanel.setLayout(null);
    UIPanel.setPreferredSize(new Dimension(300, 200));
    UIPanel.setMinimumSize(new Dimension(300, 200));
    UIPanel.setBounds(new Rectangle(0, 350, 820, 200));
    UIPanel.setMaximumSize(new Dimension(300, 32767));
    connectionPanel.setBounds(new Rectangle(10, 10, 175, 100));
    connectionPanel.setBorder(BorderFactory.createTitledBorder("Connection"));
    connectionPanel.setLayout(null);
    connectionPanel.setFont(new Font("Tahoma", 0, 11));

    jLabel1logfilename.setText("Log File:");
    jLabel1logfilename.setBounds(new Rectangle(10, 125, 165, 20));
    jLabel1logfilename.setHorizontalTextPosition(SwingConstants.RIGHT);
    jLabel1logfilename.setHorizontalAlignment(SwingConstants.LEFT);
    jLabel1logfilename.setToolTipText("Specify the name of your log file here");

    jTextFieldNXTName.setBounds(new Rectangle(5, 40, 165, 20));
    jTextFieldNXTName.setToolTipText(
            "The name or Address of the NXT. Leave empty and the first one found will be used.");

    jTextFieldNXTName.requestFocus();

    jTextAreaStatus.setLineWrap(true);
    jTextAreaStatus.setFont(new Font("Tahoma", 0, 11));
    jTextAreaStatus.setWrapStyleWord(true);
    jTextAreaStatus.setBackground(SystemColor.window);

    dataLogTextArea.setLineWrap(false);
    dataLogTextArea.setFont(new Font("Tahoma", 0, 11));
    dataLogTextArea.setBackground(SystemColor.window);

    FQPathTextArea.setBounds(new Rectangle(5, 170, 185, 40));
    FQPathTextArea.setLineWrap(true);
    FQPathTextArea.setText(getCanonicalName(new File(".", "")));
    FQPathTextArea.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    FQPathTextArea.setRows(2);

    FQPathTextArea.setFont(new Font("Tahoma", 0, 9));
    FQPathTextArea.setOpaque(false);
    FQPathTextArea.setEditable(false);

    selectFolderButton.setText("Folder...");
    selectFolderButton.setBounds(new Rectangle(120, 125, 70, 20));
    selectFolderButton.setMargin(new Insets(1, 1, 1, 1));
    selectFolderButton.setFocusable(false);
    selectFolderButton.setMnemonic('F');
    selectFolderButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            selectFolderButton_actionPerformed(e);
        }
    });

    // domain display limits GUI
    chartOptionsPanel.setLayout(null);
    chartDomLimitsPanel.setBounds(new Rectangle(5, 35, 180, 135));
    chartDomLimitsPanel.setLayout(gridLayout1);
    chartDomLimitsPanel.setBorder(BorderFactory.createTitledBorder("Domain Display Limiting"));
    domainDisplayLimitSlider.setEnabled(false);
    domainDisplayLimitSlider.setMaximum(MAXDOMAIN_DATAPOINT_LIMIT);
    domainDisplayLimitSlider.setMinimum(MINDOMAIN_LIMIT);
    domainDisplayLimitSlider.setValue(MAXDOMAIN_DATAPOINT_LIMIT);
    domainDisplayLimitSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            domainDisplayLimitSlider_stateChanged(e);
        }
    });
    useTimeRadioButton.setText("By Time");
    useTimeRadioButton.setEnabled(false);
    useTimeRadioButton.setMnemonic('I');
    useTimeRadioButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            domainDisplayLimitRadioButton_actionPerformed(e);
        }
    });
    useDataPointsRadioButton.setText("By Data Points");
    ButtonGroup bg1 = new ButtonGroup();
    bg1.add(useTimeRadioButton);
    bg1.add(useDataPointsRadioButton);
    useDataPointsRadioButton.setSelected(true);
    useDataPointsRadioButton.setEnabled(false);
    useDataPointsRadioButton.setMnemonic('P');
    useDataPointsRadioButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            domainDisplayLimitRadioButton_actionPerformed(e);
        }
    });
    datasetLimitEnableCheckBox.setText("Enable");
    datasetLimitEnableCheckBox.setRolloverEnabled(true);
    datasetLimitEnableCheckBox.setMnemonic('A');
    datasetLimitEnableCheckBox.setToolTipText("Enable Domain Clipping");
    datasetLimitEnableCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            datasetLimitEnableCheckBox_actionPerformed(e);
        }
    });
    domainLimitLabel.setText(String.format("%1$,d datapoints", MAXDOMAIN_DATAPOINT_LIMIT).toString());
    domainLimitLabel.setEnabled(false);
    gridLayout1.setRows(5);
    gridLayout1.setColumns(1);

    jLabel1.setText("Chart Title:");
    jLabel1.setBounds(new Rectangle(200, 10, 85, 20));
    jLabel1.setPreferredSize(new Dimension(115, 14));
    jLabel2.setText("Range Axis 1 Label:");
    jLabel2.setBounds(new Rectangle(200, 35, 115, 20));
    jLabel2.setSize(new Dimension(115, 20));
    jLabel3.setText("Range Axis 2 Label:");
    jLabel3.setBounds(new Rectangle(200, 60, 115, 20));
    jLabel3.setSize(new Dimension(115, 20));
    jLabel4.setText("Range Axis 3 Label:");
    jLabel4.setBounds(new Rectangle(200, 85, 115, 20));
    jLabel4.setSize(new Dimension(115, 20));
    jLabel6.setText("Range Axis 4 Label:");
    jLabel6.setBounds(new Rectangle(200, 110, 115, 20));
    jLabel6.setSize(new Dimension(115, 20));
    titleLabelChangeNotifier notifier = new titleLabelChangeNotifier();
    chartTitleTextField.setBounds(new Rectangle(315, 10, 290, 20));
    chartTitleTextField.getDocument().addDocumentListener(notifier);
    axis1LabelTextField.setBounds(new Rectangle(315, 35, 290, 20));
    axis1LabelTextField.getDocument().addDocumentListener(notifier);
    axis2LabelTextField.setBounds(new Rectangle(315, 60, 290, 20));
    axis2LabelTextField.getDocument().addDocumentListener(notifier);
    axis3LabelTextField.setBounds(new Rectangle(315, 85, 290, 20));
    axis3LabelTextField.getDocument().addDocumentListener(notifier);
    axis4LabelTextField.setBounds(new Rectangle(315, 110, 290, 20));
    showCommentsCheckBox.setText("Show Comment Markers");
    showCommentsCheckBox.setBounds(new Rectangle(200, 140, 185, 25));
    showCommentsCheckBox.setToolTipText("Show/Hide any comment markers on the chart");
    showCommentsCheckBox.setRolloverEnabled(true);
    showCommentsCheckBox.setSelected(true);
    showCommentsCheckBox.setMnemonic('M');
    showCommentsCheckBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            customChartPanel.setCommentsVisible(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    scrollDomainCheckBox.setText("Scroll Domain");
    scrollDomainCheckBox.setBounds(new Rectangle(10, 5, 175, 20));
    scrollDomainCheckBox.setSize(new Dimension(175, 25));
    scrollDomainCheckBox.setSelected(true);
    scrollDomainCheckBox.setMnemonic('O');
    scrollDomainCheckBox.setToolTipText("Checked to scroll domain as new data is received");
    scrollDomainCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scrollDomainCheckBox_actionPerformed(e);
        }
    });
    axis4LabelTextField.getDocument().addDocumentListener(notifier);

    logFileTextField.setBounds(new Rectangle(10, 145, 180, 20));
    logFileTextField.setText("NXTData.txt");
    logFileTextField.setPreferredSize(new Dimension(180, 20));
    logFileTextField.setToolTipText("File name. Leave empty to not log to file.");
    statusScrollPane.setOpaque(false);
    dataLogScrollPane.setOpaque(false);

    customChartPanel.setMinimumSize(new Dimension(400, 300));
    customChartPanel.setPreferredSize(new Dimension(812, 400));

    jLabel5.setText("NXT Name/Address:");
    jLabel5.setBounds(new Rectangle(5, 20, 160, 20));
    jLabel5.setToolTipText(jTextFieldNXTName.getToolTipText());
    jLabel5.setHorizontalTextPosition(SwingConstants.RIGHT);
    jLabel5.setHorizontalAlignment(SwingConstants.LEFT);

    connectionPanel.add(jTextFieldNXTName, null);
    connectionPanel.add(jButtonConnect, null);
    connectionPanel.add(jLabel5, null);
    dataLogScrollPane.setViewportView(dataLogTextArea);
    jTabbedPane1.addTab("Data Log", dataLogScrollPane);
    statusScrollPane.setViewportView(jTextAreaStatus);
    jTabbedPane1.addTab("Status", statusScrollPane);
    jTabbedPane1.addTab("Chart", chartOptionsPanel);
    chartDomLimitsPanel.add(datasetLimitEnableCheckBox, null);
    chartDomLimitsPanel.add(useDataPointsRadioButton, null);
    chartDomLimitsPanel.add(useTimeRadioButton, null);
    chartDomLimitsPanel.add(domainDisplayLimitSlider, null);
    chartDomLimitsPanel.add(domainLimitLabel, null);
    chartOptionsPanel.add(scrollDomainCheckBox, null);
    chartOptionsPanel.add(showCommentsCheckBox, null);
    chartOptionsPanel.add(axis4LabelTextField, null);
    chartOptionsPanel.add(axis3LabelTextField, null);
    chartOptionsPanel.add(axis2LabelTextField, null);
    chartOptionsPanel.add(axis1LabelTextField, null);
    chartOptionsPanel.add(chartTitleTextField, null);
    chartOptionsPanel.add(jLabel6, null);
    chartOptionsPanel.add(jLabel4, null);
    chartOptionsPanel.add(jLabel3, null);
    chartOptionsPanel.add(jLabel2, null);
    chartOptionsPanel.add(jLabel1, null);
    chartOptionsPanel.add(chartDomLimitsPanel, null);

    tglbtnpauseplay = new JToggleButton("");
    tglbtnpauseplay.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (lpm == null)
                return;
            boolean doPause = false;
            if (e.getStateChange() == ItemEvent.SELECTED) {
                doPause = true;
            }
            lpm.setReaderPaused(doPause);
        }
    });
    //        tglbtnpauseplay.addChangeListener(new ChangeListener() {
    //           public void stateChanged(ChangeEvent e) {
    //              System.out.println(e.toString());
    //              //lpm.setReaderPaused(doPause)
    //           }
    //        });
    tglbtnpauseplay
            .setSelectedIcon(new ImageIcon(LogChartFrame.class.getResource("/lejos/pc/charting/play.png")));
    tglbtnpauseplay.setIcon(new ImageIcon(LogChartFrame.class.getResource("/lejos/pc/charting/pause.png")));
    tglbtnpauseplay.setBounds(571, 135, 30, 30);
    chartOptionsPanel.add(tglbtnpauseplay);

    jTabbedPane1.setToolTipTextAt(0, "The tab-delimited log of the data sent from the NXT");
    jTabbedPane1.setToolTipTextAt(1, "Status output");
    jTabbedPane1.setToolTipTextAt(2, "Chart options");
    jTabbedPane1.setMnemonicAt(0, KeyEvent.VK_D);
    jTabbedPane1.setMnemonicAt(1, KeyEvent.VK_S);
    jTabbedPane1.setMnemonicAt(2, KeyEvent.VK_T);
    this.getContentPane().add(customChartPanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0,
            GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    this.getContentPane().add(UIPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), -107, 0));

    this.getContentPane().add(jTabbedPane1, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
            GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    UIPanel.add(connectionPanel, null);
    UIPanel.add(selectFolderButton, null);
    UIPanel.add(logFileTextField, null);
    UIPanel.add(jLabel1logfilename, null);
    UIPanel.add(FQPathTextArea, null);
    ActionListener taskPerformer = new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            String theData = null;
            for (;;) {
                theData = LogChartFrame.this.logDataQueue.poll();
                if (theData == null)
                    break;
                try {
                    dataLogTextArea.getDocument().insertString(dataLogTextArea.getDocument().getLength(),
                            theData, null);
                } catch (BadLocationException e) {
                    System.out.print(
                            "BadLocationException in datalog textarea updater thread:" + e.toString() + "\n");
                }
            }
        }
    };
    this.updateLogTextAreaTimer = new Timer(1000, taskPerformer);
    this.updateLogTextAreaTimer.start();
}

From source file:ded.ui.DiagramController.java

@Override
public void keyPressed(KeyEvent e) {
    this.eventReceived(e);

    // Note: Some of the key bindings shown in the help dialog
    // have been moved to the menu created in Ded.java.

    if (SwingUtil.controlPressed(e)) {
        switch (e.getKeyCode()) {
        case KeyEvent.VK_F:
            if (this.fpsMeasurementMode == false) {
                this.fpsMeasurementMode = true;
                this.fpsStartMillis = System.currentTimeMillis();
                this.fpsFrameCount = 0;
                this.fpsMeasurement = "(FPS measurement in progress)";
                this.repaint();
            } else {
                // FPS mode already active.  We get lots of key
                // events due to auto-repeat.
            }/*from   w w w.  j ava2 s .  c om*/
            break;

        case KeyEvent.VK_G:
            this.fpsMeasurementMode = false;
            break;
        }
        return;
    }

    if (SwingUtil.altPressed(e)) {
        return;
    }

    // See if the selected controller wants this keypress.
    Controller sel = this.getUniqueSelected();
    if (sel != null) {
        if (sel.keyPressed(e)) {
            return;
        }
    }

    switch (e.getKeyCode()) {
    case KeyEvent.VK_X:
        if (SwingUtil.shiftPressed(e)) {
            assert (false); // Make sure assertions are enabled.
        } else {
            throw new RuntimeException("Test exception/error message.");
        }
        break;

    case KeyEvent.VK_H:
        this.showHelpBox();
        break;

    case KeyEvent.VK_TAB:
        this.selectNextController(!SwingUtil.shiftPressed(e) /*forward*/);
        break;
    }
}

From source file:com.gele.tools.wow.wdbearmanager.WDBearManager.java

public void init(String[] args) {

    // copy ARGs/* ww w.j a va2s  .  c o m*/
    this.parseCommandLine(args);

    // Usefull for debugging
    this.myLogger.debug("java.version: " + System.getProperty("java.version"));
    this.myLogger.debug("java.vendor: " + System.getProperty("java.vendor"));
    this.myLogger.debug("java.vendor.url: " + System.getProperty("java.vendor.url"));
    this.myLogger.debug("os.name: " + System.getProperty("os.name"));
    this.myLogger.debug("os.arch: " + System.getProperty("os.arch"));
    this.myLogger.debug("os.version: " + System.getProperty("os.version"));

    if (this.paramDBconfig.length() != 0) {
        this.WDB_DB_CONFIG_FILE = this.paramDBconfig;
    }

    WDBearManager_API myAPI = new WDBearManager_API(this.WDB_DB_CONFIG_FILE);

    // Create all tables
    // -> Needed for the updata script <-
    // -> Otherwise it may crash with an empty database
    try {
        myAPI.getCountOfTable("creaturecache");
        myAPI.getCountOfTable("gameobjectcache");
        myAPI.getCountOfTable("itemcache");
        myAPI.getCountOfTable("itemnamecache");
        myAPI.getCountOfTable("itemtextchaxhe");
        myAPI.getCountOfTable("npccache");
        myAPI.getCountOfTable("pagetextcache");
        myAPI.getCountOfTable("questcache");
    } catch (Exception ex) {
        // ignore
        ex.printStackTrace();
        System.exit(0);
    }

    // Check, if database must be re-newed
    DBUpdater myDBU = new DBUpdater();
    myDBU.checkForUpdate(myAPI);

    WDBearManager_I myWoWWDBearManager_API = myAPI;

    //
    // print out some statistics
    //

    if (this.useGUI == false) {

        boolean paramSpec = false;
        // ASSERT
        DTO_Interface myDTO = null;

        if (this.paramWdbfile.length() != 0) {
            paramSpec = true;
            // Open WDB
            try {
                this.items = myWoWWDBearManager_API.readWDBfile(this.paramWdbfile);
            } catch (Exception ex) {
                this.myLogger.error("Error reading the WDB file");
                return;
            }
            // first dto -> to identify the data
            Iterator itWDBS = this.items.iterator();
            if (itWDBS.hasNext()) {
                myDTO = (DTO_Interface) itWDBS.next();
            }
        }
        // Create CSV?
        if (this.paramCSVFolder.length() != 0) {
            if (myDTO == null) {
                // NO WDB specified -> exit
                this.myLogger.error("Error: You did not specify -" + this.PARAM_WDBFILE + "\n");
                usage(this.options);
                return;
            }
            File csvFile = new File(this.paramCSVFolder, myDTO.getTableName() + ".csv");
            if (this.useVerbose) {
                this.myLogger.info("Creating CSV file: " + csvFile.getAbsolutePath());
            }
            try {
                WriteCSV.writeCSV(new File(this.paramCSVFolder), this.items);
                this.myLogger.info("CSV file written: " + csvFile.getAbsolutePath());
            } catch (Exception ex) {
                ex.printStackTrace();
                this.myLogger.error("Error writing the CSV file");
                return;
            }
        }
        // Create TXT?
        if (this.paramTXTFolder.length() != 0) {
            if (myDTO == null) {
                // NO WDB specified -> exit
                this.myLogger.error("Error: You did not specify -" + this.PARAM_WDBFILE + "\n");
                usage(this.options);
                return;
            }
            if (this.useVerbose) {
                String table = myDTO.getTableName();
                File txtFile = new File(this.paramTXTFolder, table + ".txt");
                this.myLogger.info("Creating TXT file: " + txtFile.getAbsolutePath());
            }
            try {
                WriteTXT.writeTXT(new File(this.paramTXTFolder), this.items);
            } catch (Exception ex) {
                //ex.printStackTrace();
                this.myLogger.error("Error writing the TXT file: " + ex.getMessage());
                return;
            }
        }
        // Store inside SQL database?
        if (this.writeSQL == true) {
            paramSpec = true;
            if (myDTO == null) {
                // NO WDB specified -> exit
                this.myLogger.error("Error: You did not specify -" + this.PARAM_WDBFILE + "\n");
                usage(this.options);
                return;
            }
            if (this.useVerbose) {
                this.myLogger.info("Storing data inside SQL database");
            }
            SQLManager myWriteSQL = null;
            try {
                myWriteSQL = new SQLManager(this.WDB_DB_CONFIG_FILE);
                ObjectsWritten myOWr = myWriteSQL.insertOrUpdateToSQLDB(this.items, this.doUpdate);
                this.myLogger.info("Operation successfull");
                if (this.useVerbose) {
                    this.myLogger.info("DB statistics");
                    this.myLogger.info("INSERT: " + myOWr.getNumInsert());
                    this.myLogger.info("UPDATE: " + myOWr.getNumUpdate());
                    this.myLogger.info("Error INSERT: " + myOWr.getNumErrorInsert());
                    this.myLogger.info("Error UPDATE: " + myOWr.getNumErrorUpdate());
                    if (this.doUpdate == false) {
                        this.myLogger.info("Objects skipped: " + myOWr.getNumSkipped());
                        System.out.println("If you want to overwrite/update objects, use 'update' param");
                    }
                    this.myLogger.info(WDBearManager.VERSION_INFO);
                }
            } catch (Exception ex) {
                ex.printStackTrace();
                this.myLogger.error("Error importing to database");
                this.myLogger.error(ex.getMessage());
                return;
            }
        } // writeSQL

        // Patch *.SCP with contents of database
        if (this.paramSCPname.length() != 0) {
            if (this.paramPatchSCP.length() == 0) {
                this.myLogger.error("Error: You did not specify -" + WDBearManager.PATCH_SCP + "\n");
                usage(this.options);
                return;
            }

            paramSpec = true;
            this.myLogger.info("Patch scp file with the contents of the database");
            try {

                SCPWritten mySCPW = myWoWWDBearManager_API.patchSCP(this.paramSCPname, this.paramPatchSCP,
                        this.patchUTF8, this.paramLocale);
                if (this.useVerbose) {
                    this.myLogger.info("Merge statistics");
                    System.out.println("Entries in database:    " + mySCPW.getNumInDB());
                    this.myLogger.info("Merged with SCP: " + mySCPW.getNumPatched());
                    this.myLogger.info("Patched IDs:      " + mySCPW.getPatchedIDs());
                }
                this.myLogger.info("Patched file: " + this.paramSCPname + "_patch");
            } catch (WDBMgr_IOException ex) {
                this.myLogger.error("The destination SCP file could not be created");
                this.myLogger.error(ex.getMessage());
                return;
            } catch (WDBMgr_NoDataAvailableException ex) {
                this.myLogger.info("Merging impossible");
                this.myLogger.info("There are no entries inside the database");
            } catch (Exception ex) {
                this.myLogger.error("Error while merging quests.scp with database");
                this.myLogger.error(ex.getMessage());
                return;
            }
        } // PatchSCP

        // Call jython script?
        if (this.paramScript.length() != 0) {
            paramSpec = true;
            this.myLogger.info("Calling Jython script");
            this.myLogger.info("---");
            PythonInterpreter interp = new PythonInterpreter();

            interp.set("wdbmgrapi", myWoWWDBearManager_API);
            // set parameters
            Set setKeys = this.paramJython.keySet();
            Iterator itKeys = setKeys.iterator();
            String jyParam = "";
            while (itKeys.hasNext()) {
                jyParam = (String) itKeys.next();
                interp.set(jyParam, (String) this.paramJython.get(jyParam));
            }
            interp.execfile(this.paramScript);

            this.myLogger.info("---");
            System.out.println("Jython script executed, " + WDBearManager.VERSION_INFO);
            return;
        } // paramScript

        if (paramSpec == false) {
            usage(this.options);
            return;
        }

        // Exit
        return;
    } // Command Line Version

    //
    // GUI
    //
    PlasticLookAndFeel.setMyCurrentTheme(new DesertBlue());
    try {
        UIManager.put("ClassLoader", LookUtils.class.getClassLoader());
        UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
    } catch (Exception e) {
    }
    //    try {
    //      com.incors.plaf.kunststoff.KunststoffLookAndFeel kunststoffLnF = new com.incors.plaf.kunststoff.KunststoffLookAndFeel();
    //      KunststoffLookAndFeel
    //          .setCurrentTheme(new com.incors.plaf.kunststoff.KunststoffTheme());
    //      UIManager.setLookAndFeel(kunststoffLnF);
    //    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
    //      // handle exception or not, whatever you prefer
    //    }
    //     this line needs to be implemented in order to make JWS work properly
    UIManager.getLookAndFeelDefaults().put("ClassLoader", getClass().getClassLoader());

    this.setTitle(WDBearManager.VERSION_INFO);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.getContentPane().setLayout(new BorderLayout());

    // construct GUI to display the stuff
    // Menu
    //  Where the GUI is created:
    JMenuBar menuBar;
    JMenu menu; //, submenu;
    JMenuItem menuItem;
    //JRadioButtonMenuItem rbMenuItem;
    //JCheckBoxMenuItem cbMenuItem;

    //    Create the menu bar.
    menuBar = new JMenuBar();

    //    Build the first menu.
    menu = new JMenu("File");
    menu.setMnemonic(KeyEvent.VK_A);
    menu.getAccessibleContext().setAccessibleDescription("Process WDB files");
    menuBar.add(menu);

    // Exit
    menuItem = new JMenuItem(MENU_EXIT, KeyEvent.VK_T);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Exit program");
    menuItem.addActionListener(this);
    menu.add(menuItem);

    //    Build the first menu.
    menu = new JMenu("About");
    menu.setMnemonic(KeyEvent.VK_A);
    menu.getAccessibleContext().setAccessibleDescription("Whassup?");
    menuBar.add(menu);
    // Help
    menuItem = new JMenuItem(MENU_HELP, KeyEvent.VK_H);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Help me...");
    menuItem.addActionListener(this);
    menu.add(menuItem);
    // JavaDocs
    menuItem = new JMenuItem(MENU_JDOCS, KeyEvent.VK_J);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_J, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Show API docs...");
    menuItem.addActionListener(this);
    menu.add(menuItem);
    // separator
    menu.addSeparator();
    // CheckForUpdate
    menuItem = new JMenuItem(MENU_CHECKUPDATE, KeyEvent.VK_U);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Check for update...");
    menuItem.addActionListener(this);
    menu.add(menuItem);
    // separator
    menu.addSeparator();
    // ABOUT
    menuItem = new JMenuItem(MENU_ABOUT, KeyEvent.VK_T);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.ALT_MASK));
    menuItem.getAccessibleContext().setAccessibleDescription("Ueber...");
    menuItem.addActionListener(this);
    menu.add(menuItem);

    this.setJMenuBar(menuBar);

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new GridLayout(0, 1));

    JTabbedPane tabbedPane = new JTabbedPane();
    ImageIcon wowIcon = createImageIcon("images/fromdisk.gif");

    JComponent panel1 = new WDB_Panel(myWoWWDBearManager_API);
    tabbedPane.addTab("WDB-Module", wowIcon, panel1, "Handle WDB files");
    tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

    ImageIcon panelIcon = createImageIcon("images/hsql.gif");
    JComponent panel2 = null;
    try {
        panel2 = new SQL_Panel(myWoWWDBearManager_API);
    } catch (Throwable ex) {
        System.err.println("Error while instantiating SQL Panel: ");
        System.err.println(ex.getMessage());
        ex.printStackTrace();
        System.exit(0);
    }
    tabbedPane.addTab("DB-Module", panelIcon, panel2, "Handle database");
    tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

    panelIcon = createImageIcon("images/pythonpoweredsmall.gif");
    JComponent panel3 = new Python_Panel(myWoWWDBearManager_API);
    tabbedPane.addTab("Scripts", panelIcon, panel3, "Scripting");
    tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

    // maybe user PLUGIN availabe
    // -> check for folders below "plugins"
    File filUserPanels = new File("plugins");
    // 1) find user plugins (scan for directories)
    // 2) scan for <name>.properties, where <name> is the name of the directory
    // 3) load the properties file and get the plugin running
    String[] strUserPlugins = filUserPanels.list(new FilenameFilter() {
        public boolean accept(File dir, String name) {
            return (new File(dir, name).isDirectory());
        }
    });
    if (strUserPlugins != null) {
        ArrayList urlJars = new ArrayList();

        //URL[] urlJars = new URL[strUserPlugins.length];
        String strCurrJar = "";
        String strPlugins[] = new String[strUserPlugins.length];
        try {
            for (int i = 0; i < strUserPlugins.length; i++) {
                File baseFile = new File("plugins", strUserPlugins[i]);
                File filProperties = new File(baseFile, strUserPlugins[i] + ".properties");
                if (filProperties.exists()) {
                    // set plugin folder and .properties name
                    strPlugins[i] = strUserPlugins[i];
                    this.myLogger.info("Found 'plugin' : " + baseFile.getAbsolutePath());
                    this.myLogger.info("                 Trying to load .jar file");

                    // Scan for JAR files and include them
                    //System.out.println(baseFile.getAbsolutePath());
                    String[] strJars = baseFile.list(new FilenameFilter() {
                        public boolean accept(File dir, String name) {
                            return name.endsWith(".jar");
                        }
                    });
                    for (int j = 0; j < strJars.length; j++) {
                        File filJAR = new File(baseFile, strJars[j]);
                        strCurrJar = filJAR.getAbsolutePath();

                        this.myLogger.info("Loading external 'plugin' JAR: " + strCurrJar);
                        URL jarfile = new URL("jar", "", "file:" + strCurrJar + "!/");
                        urlJars.add(jarfile);
                    }

                } else {
                    // print warning - a directory inside plugins, but there is no plugin
                    this.myLogger.warn("Found directory inside plugins folder, but no .properties file");
                    this.myLogger.warn("      Name of directory: " + strUserPlugins[i]);
                    this.myLogger.warn("      Please review the directory!");
                }
            } // for... all user plugins
        } catch (Exception ex) {
            this.myLogger.error("Plugin: Error loading " + strCurrJar);
            this.myLogger.error("Please check your 'plugin' folder");
        }
        URLClassLoader cl = null;
        try {
            //      File file = new File("plugins", strUserJars[i]);
            //      this.myLogger.info("Lade externes JAR: " + file.getAbsolutePath());
            //      URL jarfile = new URL("jar", "", "file:" + file.getAbsolutePath() + "!/");
            URL[] loadURLs = new URL[urlJars.toArray().length];
            for (int j = 0; j < urlJars.toArray().length; j++) {
                loadURLs[j] = (URL) urlJars.get(j);
            }
            cl = URLClassLoader.newInstance(loadURLs);

            Thread.currentThread().setContextClassLoader(cl);

            //      String lcStr = "Test";
            //      Class loadedClass = cl.loadClass(lcStr);
            //      this.myLogger.info("Smooth...");

        } catch (Exception ex) {
            ex.printStackTrace();
        }

        // 2) load properties and instantiate the plugin
        //      String[] strPlugins = filUserPanels.list(new FilenameFilter() {
        //        public boolean accept(File dir, String name) {
        //          return (name.endsWith("_plugin.properties"));
        //        }
        //      });
        String strPluginName = "";
        String strPluginClass = "";
        String strPluginImage = "";
        WDBearPlugin pluginPanel = null;
        for (int i = 0; i < strPlugins.length; i++) {
            //this.myLogger.info(strPlugins[i]);
            Properties prpPlugin = null;
            try {
                prpPlugin = ReadPropertiesFile.readProperties(
                        new File("plugins", strPlugins[i] + "/" + strPlugins[i]).getAbsolutePath()
                                + ".properties");
            } catch (Exception ex) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Could not load properties file");
                continue;
            }
            if ((strPluginClass = prpPlugin.getProperty(this.PLUGIN_CLASS)) == null) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Property '" + this.PLUGIN_CLASS + "' not found");
                continue;
            }
            if ((strPluginName = prpPlugin.getProperty(this.PLUGIN_NAME)) == null) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Property '" + this.PLUGIN_NAME + "' not found");
                continue;
            }
            if ((strPluginImage = prpPlugin.getProperty(this.PLUGIN_IMAGE)) == null) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Property '" + this.PLUGIN_IMAGE + "' not found");
                continue;
            }

            File filPlgImg = new File("plugins", strPlugins[i] + "/" + strPluginImage);
            panelIcon = createImageIcon(filPlgImg.getAbsolutePath());
            if (panelIcon == null) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Could not read image '" + strPluginImage + "'");
                continue;
            }
            try {
                pluginPanel = (WDBearPlugin) (cl.loadClass(strPluginClass).newInstance());
                pluginPanel.runPlugin(myAPI);
            } catch (Exception ex) {
                this.myLogger.error("Error with plugin: " + strPlugins[i]);
                this.myLogger.error("Could not instantiate '" + strPluginClass + "'");
                ex.printStackTrace();
                continue;
            }
            tabbedPane.addTab(strPluginName, panelIcon, pluginPanel, strPluginName);
        } // Plugins
    } // plugins folder found

    mainPanel.add(tabbedPane);

    this.getContentPane().add(mainPanel, BorderLayout.CENTER);

    this.setSize(1024, 768);
    //this.pack();
    this.show();

}

From source file:mondrian.gui.Workbench.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    jToolBar1.add(jPanel2, 0);

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

    jToolBar1.add(toolbarOpenButton);

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

    jToolBar1.add(toolbarSaveButton);

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

    jToolBar1.add(toolbarSaveAsButton);

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

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

    jToolBar1.add(toolbarPreferencesButton);

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

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

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

    newMenu.add(newSchemaMenuItem);

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

    newMenu.add(newQueryMenuItem);

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

    newMenu.add(newJDBCExplorerMenuItem);

    fileMenu.add(newMenu);

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

    fileMenu.add(openMenuItem);

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

    fileMenu.add(saveMenuItem);

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

    fileMenu.add(saveAsMenuItem);

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

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

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

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

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

    updateLastUsedMenu();
    fileMenu.add(jSeparator1);

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

    fileMenu.add(exitMenuItem);

    menuBar.add(fileMenu);

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

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

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

    editMenu.add(deleteMenuItem);

    menuBar.add(editMenu);

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

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

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

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

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

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

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

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

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

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

    menuBar.add(windowMenu);

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

    helpMenu.add(aboutMenuItem);

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

    setJMenuBar(menuBar);

    pack();
}

From source file:edu.harvard.mcz.imagecapture.MainFrame.java

/**
 * This method initializes jMenuItemLog   
 *    //from  w w  w  .  ja va 2 s  .com
 * @return javax.swing.JMenuItem   
 */
private JMenuItem getJMenuItemLog() {
    if (jMenuItemLog == null) {
        jMenuItemLog = new JMenuItem();
        jMenuItemLog.setText("View History");
        jMenuItemLog.setMnemonic(KeyEvent.VK_H);
        jMenuItemLog.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent e) {
                EventLogFrame logWindow = new EventLogFrame();
                logWindow.pack();
                logWindow.setVisible(true);
                System.gc();
            }
        });
    }
    return jMenuItemLog;
}

From source file:com.igormaznitsa.jhexed.swing.editor.ui.MainForm.java

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

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

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

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

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

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

    labelCellUnderMouse.setText("   ");

    labelZoomStatus.setText("   ");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    menuMain.add(menuFile);

    menuEdit.setText("Edit");

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

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

    menuMain.add(menuEdit);

    menuView.setText("View");

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

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

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

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

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

    menuMain.add(menuView);

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

    menuWindow.setText("Window");

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

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

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

    menuMain.add(menuWindow);

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

    menuHelp.setText("Help");

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

    menuMain.add(menuHelp);

    setJMenuBar(menuMain);

    pack();
}