Example usage for java.awt.event InputEvent ALT_MASK

List of usage examples for java.awt.event InputEvent ALT_MASK

Introduction

In this page you can find the example usage for java.awt.event InputEvent ALT_MASK.

Prototype

int ALT_MASK

To view the source code for java.awt.event InputEvent ALT_MASK.

Click Source Link

Document

The Alt key modifier constant.

Usage

From source file:processing.app.syntax.SketchTextArea.java

private void fixCtrlDeleteBehavior() {
    int modifier = OSUtils.isMacOS() ? InputEvent.ALT_MASK : InputEvent.CTRL_MASK;
    KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, modifier);
    getInputMap().put(keyStroke, SketchTextAreaEditorKit.rtaDeleteNextWordAction);
}

From source file:com.googlecode.bpmn_simulator.gui.BPMNSimulatorFrame.java

private JMenu createMenuHelp() {
    final JMenu menuHelp = new JMenu(Messages.getString("Menu.help")); //$NON-NLS-1$

    final JMenuItem menuHelpAbout = new JMenuItem(Messages.getString("Menu.about")); //$NON-NLS-1$
    menuHelpAbout.setMnemonic(KeyEvent.VK_A);
    menuHelpAbout.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.ALT_MASK));
    menuHelpAbout.addActionListener(new ActionListener() {
        @Override/* ww  w  . j  a v  a  2 s  .c o  m*/
        public void actionPerformed(final ActionEvent e) {
            showAboutDialog();
        }
    });
    menuHelp.add(menuHelpAbout);

    return menuHelp;
}

From source file:com.googlecode.bpmn_simulator.gui.BPMNSimulatorFrame.java

@Override
protected JMenu createWindowMenu() {
    final JMenu menuWindow = new JMenu(Messages.getString("Menu.windows")); //$NON-NLS-1$

    final JMenuItem menuWindowElements = new JMenuItem(Messages.getString("Menu.elements")); //$NON-NLS-1$
    menuWindowElements.setMnemonic(KeyEvent.VK_E);
    menuWindowElements.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK));
    menuWindowElements.addActionListener(new ActionListener() {
        @Override//from w w  w  .  ja  va  2 s . c o  m
        public void actionPerformed(final ActionEvent e) {
            showElementsFrame();
        }
    });
    menuWindow.add(menuWindowElements);

    final JMenuItem menuWindowInstances = new JMenuItem(Messages.getString("Menu.instances")); //$NON-NLS-1$
    menuWindowInstances.setMnemonic(KeyEvent.VK_I);
    menuWindowInstances.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.ALT_MASK));
    menuWindowInstances.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            showInstancesFrame();
        }
    });
    menuWindow.add(menuWindowInstances);

    final JMenu menuWindowDiagram = super.createWindowMenu();
    menuWindowDiagram.setText(Messages.getString("Menu.diagrams"));
    menuWindow.add(menuWindowDiagram);

    return menuWindow;
}

From source file:wsattacker.sso.openid.attacker.gui.MainGui.java

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

    saveFileChooser = new JFileChooser();
    loadFileChooser = new JFileChooser();
    xmlFileFilter = new XmlFileFilter();
    controller = new ServerController();
    serverStatusToIconConverter = new ServerStatusToIconConverter();
    splitPane = new JSplitPane();
    jXTaskPaneContainer1 = new JXTaskPaneContainer();
    attackerIdpTaskPane = new JXTaskPane();
    analyzerIdpTaskPane = new JXTaskPane();
    evaluationTaskPane = new JXTaskPane();
    logTaskPane = new JXTaskPane();
    menuBar = new JMenuBar();
    fileMenu = new JMenu();
    saveItem = new JMenuItem();
    loadItem = new JMenuItem();
    jSeparator2 = new JPopupMenu.Separator();
    clearLogMenuItem = new JMenuItem();
    jSeparator1 = new JPopupMenu.Separator();
    exitNoConfigSave = new JMenuItem();
    exitAndSaveConfig = new JMenuItem();

    saveFileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
    saveFileChooser.setFileFilter(xmlFileFilter);

    loadFileChooser.setFileFilter(xmlFileFilter);
    loadFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        public void windowOpened(WindowEvent evt) {
            formWindowOpened(evt);
        }

        public void windowClosing(WindowEvent evt) {
            formWindowClosing(evt);
        }
    });

    splitPane.setBorder(null);
    splitPane.setDividerLocation(200);
    splitPane.setDividerSize(0);

    jXTaskPaneContainer1.setMinimumSize(new Dimension(200, 259));
    jXTaskPaneContainer1.setPreferredSize(new Dimension(200, 10));
    VerticalLayout verticalLayout1 = new VerticalLayout();
    verticalLayout1.setGap(14);
    jXTaskPaneContainer1.setLayout(verticalLayout1);

    attackerIdpTaskPane.setFocusable(false);
    attackerIdpTaskPane.setTitle("Attacker IdP");

    Binding binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE, controller,
            ELProperty.create("${attackerServer.status}"), attackerIdpTaskPane, BeanProperty.create("icon"));
    binding.setConverter(serverStatusToIconConverter);
    bindingGroup.addBinding(binding);

    jXTaskPaneContainer1.add(attackerIdpTaskPane);

    analyzerIdpTaskPane.setFocusable(false);
    analyzerIdpTaskPane.setTitle("Analyzer IdP");

    binding = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ_WRITE, controller,
            ELProperty.create("${analyzerServer.status}"), analyzerIdpTaskPane, BeanProperty.create("icon"));
    binding.setConverter(serverStatusToIconConverter);
    bindingGroup.addBinding(binding);

    jXTaskPaneContainer1.add(analyzerIdpTaskPane);

    evaluationTaskPane.setFocusable(false);
    evaluationTaskPane.setTitle("Evaluation");
    jXTaskPaneContainer1.add(evaluationTaskPane);

    logTaskPane.setFocusable(false);
    logTaskPane.setTitle("Other");
    jXTaskPaneContainer1.add(logTaskPane);

    splitPane.setLeftComponent(jXTaskPaneContainer1);

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

    saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_MASK));
    saveItem.setText("Save Config");
    saveItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            saveItemActionPerformed(evt);
        }
    });
    fileMenu.add(saveItem);

    loadItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.ALT_MASK));
    loadItem.setText("Load Config");
    loadItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            loadItemActionPerformed(evt);
        }
    });
    fileMenu.add(loadItem);
    fileMenu.add(jSeparator2);

    clearLogMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK));
    clearLogMenuItem.setText("Clear Log");
    clearLogMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            clearLogMenuItemActionPerformed(evt);
        }
    });
    fileMenu.add(clearLogMenuItem);
    fileMenu.add(jSeparator1);

    exitNoConfigSave.setText("Exit (without saving config)");
    exitNoConfigSave.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            exitNoConfigSaveActionPerformed(evt);
        }
    });
    fileMenu.add(exitNoConfigSave);

    exitAndSaveConfig.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.META_MASK));
    exitAndSaveConfig.setText("Exit");
    exitAndSaveConfig.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            exitAndSaveConfigActionPerformed(evt);
        }
    });
    fileMenu.add(exitAndSaveConfig);

    menuBar.add(fileMenu);

    setJMenuBar(menuBar);

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(splitPane,
            GroupLayout.DEFAULT_SIZE, 960, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(splitPane,
            GroupLayout.DEFAULT_SIZE, 528, Short.MAX_VALUE));

    bindingGroup.bind();

    pack();
}

From source file:JXTransformer.java

public TransformerDemo() {
        super("Transformer demo");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JMenuBar bar = new JMenuBar();
        JMenu lafMenu = new JMenu("LaF");

        JMenuItem winLaf = new JMenuItem("Windows LaF");
        lafMenu.add(winLaf);//  ww w. j  a  v a2 s.  c o  m
        winLaf.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setLaf("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            }
        });
        JMenuItem motifLaf = new JMenuItem("Motif LaF");
        lafMenu.add(motifLaf);
        motifLaf.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setLaf("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
            }
        });
        bar.add(lafMenu);
        JMenuItem metalLaf = new JMenuItem("Metal LaF");
        lafMenu.add(metalLaf);
        metalLaf.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                setLaf("javax.swing.plaf.metal.MetalLookAndFeel");
            }
        });

        JMenu settingsMenu = new JMenu("Settings");
        settingsMenu.setMnemonic(KeyEvent.VK_S);
        JMenuItem item = new JMenuItem("Reset sliders", KeyEvent.VK_R);
        item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_MASK));
        item.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                rotationSlider.setValue(0);
                scalingSlider.setValue(100);
                shearingSlider.setValue(0);
            }
        });
        settingsMenu.add(item);
        bar.add(settingsMenu);
        setJMenuBar(bar);

        JPanel panel = new JPanel(new BorderLayout());
        panel.add(createDemoPanel());
        panel.add(createStressTestPanel(), BorderLayout.EAST);
        add(new JScrollPane(panel));
        add(new JScrollPane(createToolPanel()), BorderLayout.SOUTH);
        pack();
    }

From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java

/**
 * Constructs a JFreeChart panel.// ww w  . j  av a 2  s .com
 * 
 * @param chart
 *            the chart.
 * @param width
 *            the preferred width of the panel.
 * @param height
 *            the preferred height of the panel.
 * @param minimumDrawWidth
 *            the minimum drawing width.
 * @param minimumDrawHeight
 *            the minimum drawing height.
 * @param maximumDrawWidth
 *            the maximum drawing width.
 * @param maximumDrawHeight
 *            the maximum drawing height.
 * @param useBuffer
 *            a flag that indicates whether to use the off-screen buffer to improve performance
 *            (at the expense of memory).
 * @param properties
 *            a flag indicating whether or not the chart property editor should be available via
 *            the popup menu.
 * @param copy
 *            a flag indicating whether or not a copy option should be available via the popup
 *            menu.
 * @param save
 *            a flag indicating whether or not save options should be available via the popup
 *            menu.
 * @param print
 *            a flag indicating whether or not the print option should be available via the
 *            popup menu.
 * @param zoom
 *            a flag indicating whether or not zoom options should be added to the popup menu.
 * @param tooltips
 *            a flag indicating whether or not tooltips should be enabled for the chart.
 * 
 * @since 1.0.13
 */
public AbstractChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight,
        int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean copy,
        boolean save, boolean print, boolean zoom, boolean tooltips) {
    super(chart, width, height, minimumDrawWidth, minimumDrawHeight, maximumDrawWidth, maximumDrawHeight, false,
            properties, copy, save, print, zoom, tooltips);
    setChart(chart);
    this.chartMouseListeners = new EventListenerList();
    this.info = new ChartRenderingInfo();
    setPreferredSize(new Dimension(width, height));

    this.minimumDrawWidth = minimumDrawWidth;
    this.minimumDrawHeight = minimumDrawHeight;
    this.maximumDrawWidth = maximumDrawWidth;
    this.maximumDrawHeight = maximumDrawHeight;
    this.zoomTriggerDistance = DEFAULT_ZOOM_TRIGGER_DISTANCE;

    // set up popup menu...
    this.popup = null;
    if (properties || copy || save || print || zoom) {
        this.popup = createPopupMenu(properties, copy, save, print, zoom);
    }

    enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
    setDisplayToolTips(tooltips);
    // mouse listener registered in super class
    // addMouseListener(this);
    // addMouseMotionListener(this);

    this.defaultDirectoryForSaveAs = null;
    this.enforceFileExtensions = true;

    // initialize ChartPanel-specific tool tip delays with
    // values the from ToolTipManager.sharedInstance()
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    this.ownToolTipInitialDelay = ttm.getInitialDelay();
    this.ownToolTipDismissDelay = ttm.getDismissDelay();
    this.ownToolTipReshowDelay = ttm.getReshowDelay();

    this.zoomAroundAnchor = false;
    this.selectionOutlinePaint = Color.blue;
    this.selectionFillPaint = new Color(0, 0, 255, 63);

    this.panMask = InputEvent.CTRL_MASK;
    // for MacOSX we can't use the CTRL key for mouse drags, see:
    // http://developer.apple.com/qa/qa2004/qa1362.html
    String osName = System.getProperty("os.name").toLowerCase();
    if (osName.startsWith("mac os x")) {
        this.panMask = InputEvent.ALT_MASK;
    }

    this.overlays = new java.util.ArrayList<>();

    // adding wheel listener
    addMouseWheelListener(new MouseWheelListener() {

        @Override
        public void mouseWheelMoved(MouseWheelEvent e) {
            if (e.getScrollType() != MouseWheelEvent.WHEEL_UNIT_SCROLL) {
                return;
            }
            if (e.getWheelRotation() < 0) {
                shrinkSelectionOnCenter(e.getX(), e.getY(), e);
            } else {
                enlargeSelectionOnCenter(e.getX(), e.getY(), e);
            }
        }
    });
}

From source file:com.igormaznitsa.zxpoly.MainForm.java

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

    scrollPanel = new javax.swing.JScrollPane();
    jSeparator2 = new javax.swing.JSeparator();
    panelIndicators = new javax.swing.JPanel();
    filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0),
            new java.awt.Dimension(32767, 0));
    labelTurbo = new javax.swing.JLabel();
    labelMouseUsage = new javax.swing.JLabel();
    labelZX128 = new javax.swing.JLabel();
    labelTapeUsage = new javax.swing.JLabel();
    labelDiskUsage = new javax.swing.JLabel();
    menuBar = new javax.swing.JMenuBar();
    menuFile = new javax.swing.JMenu();
    menuFileLoadSnapshot = new javax.swing.JMenuItem();
    menuFileLoadTap = new javax.swing.JMenuItem();
    menuLoadDrive = new javax.swing.JMenu();
    menuFileSelectDiskA = new javax.swing.JMenuItem();
    jMenuItem1 = new javax.swing.JMenuItem();
    jMenuItem2 = new javax.swing.JMenuItem();
    jMenuItem3 = new javax.swing.JMenuItem();
    jSeparator1 = new javax.swing.JPopupMenu.Separator();
    menuFileOptions = new javax.swing.JMenuItem();
    jSeparator3 = new javax.swing.JPopupMenu.Separator();
    menuFileExit = new javax.swing.JMenuItem();
    menuTap = new javax.swing.JMenu();
    menuTapeRewindToStart = new javax.swing.JMenuItem();
    menuTapPrevBlock = new javax.swing.JMenuItem();
    menuTapPlay = new javax.swing.JCheckBoxMenuItem();
    menuTapNextBlock = new javax.swing.JMenuItem();
    menuTapGotoBlock = new javax.swing.JMenuItem();
    menuService = new javax.swing.JMenu();
    menuFileReset = new javax.swing.JMenuItem();
    menuResetKeyboard = new javax.swing.JMenuItem();
    menuServiceSaveScreen = new javax.swing.JMenuItem();
    menuTapExportAs = new javax.swing.JMenu();
    menuTapExportAsWav = new javax.swing.JMenuItem();
    menuTracer = new javax.swing.JMenu();
    menuTraceCPU0 = new javax.swing.JCheckBoxMenuItem();
    menuTraceCPU1 = new javax.swing.JCheckBoxMenuItem();
    menuTraceCPU2 = new javax.swing.JCheckBoxMenuItem();
    menuTraceCPU3 = new javax.swing.JCheckBoxMenuItem();
    menuOptions = new javax.swing.JMenu();
    menuOptionsShowIndicators = new javax.swing.JCheckBoxMenuItem();
    menuOptionsZX128Mode = new javax.swing.JCheckBoxMenuItem();
    menuOptionsTurbo = new javax.swing.JCheckBoxMenuItem();
    menuHelp = new javax.swing.JMenu();
    menuHelpAbout = new javax.swing.JMenuItem();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setLocationByPlatform(true);
    addWindowFocusListener(new java.awt.event.WindowFocusListener() {
        public void windowGainedFocus(java.awt.event.WindowEvent evt) {
            formWindowGainedFocus(evt);
        }

        public void windowLostFocus(java.awt.event.WindowEvent evt) {
            formWindowLostFocus(evt);
        }
    });

    scrollPanel.setViewportView(jSeparator2);

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

    panelIndicators.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    panelIndicators.setLayout(new java.awt.GridBagLayout());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 4;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1000.0;
    panelIndicators.add(filler1, gridBagConstraints);

    labelTurbo.setText(" ");
    labelTurbo.setToolTipText("Shows turbo mode on");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 5;
    gridBagConstraints.gridy = 0;
    panelIndicators.add(labelTurbo, gridBagConstraints);

    labelMouseUsage.setText(" ");
    labelMouseUsage.setToolTipText("Indicates kempston mouse activation, ESC - deactivate mouse");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 6;
    gridBagConstraints.gridy = 0;
    panelIndicators.add(labelMouseUsage, gridBagConstraints);

    labelZX128.setText(" ");
    labelZX128.setToolTipText("Shows that active ZX128 emulation mode");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 7;
    gridBagConstraints.gridy = 0;
    panelIndicators.add(labelZX128, gridBagConstraints);

    labelTapeUsage.setText(" ");
    labelTapeUsage.setToolTipText("Shows tape activity");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 8;
    gridBagConstraints.gridy = 0;
    panelIndicators.add(labelTapeUsage, gridBagConstraints);

    labelDiskUsage.setText(" ");
    labelDiskUsage.setToolTipText("Shows disk activity");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 9;
    gridBagConstraints.gridy = 0;
    panelIndicators.add(labelDiskUsage, gridBagConstraints);

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

    menuFile.setText("File");

    menuFileLoadSnapshot.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/snapshot.png"))); // NOI18N
    menuFileLoadSnapshot.setText("Load Snapshot");
    menuFileLoadSnapshot.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileLoadSnapshotActionPerformed(evt);
        }
    });
    menuFile.add(menuFileLoadSnapshot);

    menuFileLoadTap.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/cassette.png"))); // NOI18N
    menuFileLoadTap.setText("Load TAPE");
    menuFileLoadTap.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileLoadTapActionPerformed(evt);
        }
    });
    menuFile.add(menuFileLoadTap);

    menuLoadDrive.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/disk.png"))); // NOI18N
    menuLoadDrive.setText("Load Disk..");

    menuFileSelectDiskA.setText("Drive A");
    menuFileSelectDiskA.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileSelectDiskAActionPerformed(evt);
        }
    });
    menuLoadDrive.add(menuFileSelectDiskA);

    jMenuItem1.setText("Drive B");
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem1ActionPerformed(evt);
        }
    });
    menuLoadDrive.add(jMenuItem1);

    jMenuItem2.setText("Drive C");
    jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem2ActionPerformed(evt);
        }
    });
    menuLoadDrive.add(jMenuItem2);

    jMenuItem3.setText("Drive D");
    jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem3ActionPerformed(evt);
        }
    });
    menuLoadDrive.add(jMenuItem3);

    menuFile.add(menuLoadDrive);
    menuFile.add(jSeparator1);

    menuFileOptions.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/settings.png"))); // NOI18N
    menuFileOptions.setText("Options");
    menuFileOptions.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileOptionsActionPerformed(evt);
        }
    });
    menuFile.add(menuFileOptions);
    menuFile.add(jSeparator3);

    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/zxpoly/icons/reset.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);

    menuBar.add(menuFile);

    menuTap.setText("Tape");

    menuTapeRewindToStart.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_previous.png"))); // NOI18N
    menuTapeRewindToStart.setText("Rewind to start");
    menuTapeRewindToStart.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuTapeRewindToStartActionPerformed(evt);
        }
    });
    menuTap.add(menuTapeRewindToStart);

    menuTapPrevBlock.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_backward.png"))); // NOI18N
    menuTapPrevBlock.setText("Prev block");
    menuTapPrevBlock.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuTapPrevBlockActionPerformed(evt);
        }
    });
    menuTap.add(menuTapPrevBlock);

    menuTapPlay.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, 0));
    menuTapPlay.setText("Play");
    menuTapPlay.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_play.png"))); // NOI18N
    menuTapPlay.setInheritsPopupMenu(true);
    menuTapPlay.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuTapPlayActionPerformed(evt);
        }
    });
    menuTap.add(menuTapPlay);

    menuTapNextBlock.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_forward.png"))); // NOI18N
    menuTapNextBlock.setText("Next block");
    menuTapNextBlock.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuTapNextBlockActionPerformed(evt);
        }
    });
    menuTap.add(menuTapNextBlock);

    menuTapGotoBlock.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_pos.png"))); // NOI18N
    menuTapGotoBlock.setText("Go to block");
    menuTapGotoBlock.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuTapGotoBlockActionPerformed(evt);
        }
    });
    menuTap.add(menuTapGotoBlock);

    menuBar.add(menuTap);

    menuService.setText("Service");

    menuFileReset.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F12, 0));
    menuFileReset.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/reset2.png"))); // NOI18N
    menuFileReset.setText("Reset");
    menuFileReset.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuFileResetActionPerformed(evt);
        }
    });
    menuService.add(menuFileReset);

    menuResetKeyboard.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/keyboard.png"))); // NOI18N
    menuResetKeyboard.setText("Reset keyboard");
    menuResetKeyboard.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuResetKeyboardActionPerformed(evt);
        }
    });
    menuService.add(menuResetKeyboard);

    menuServiceSaveScreen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F8, 0));
    menuServiceSaveScreen.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/photo.png"))); // NOI18N
    menuServiceSaveScreen.setText("Make Screenshot");
    menuServiceSaveScreen.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuServiceSaveScreenActionPerformed(evt);
        }
    });
    menuService.add(menuServiceSaveScreen);

    menuTapExportAs.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/com/igormaznitsa/zxpoly/icons/tape_record.png"))); // NOI18N
    menuTapExportAs.setText("Export TAPE as..");

    menuTapExportAsWav.setText("WAV file");
    menuTapExportAsWav.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuTapExportAsWavActionPerformed(evt);
        }
    });
    menuTapExportAs.add(menuTapExportAsWav);

    menuService.add(menuTapExportAs);

    menuTracer.setText("Trace");

    menuTraceCPU0.setText("CPU0");
    menuTraceCPU0.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuTraceCPU0ActionPerformed(evt);
        }
    });
    menuTracer.add(menuTraceCPU0);

    menuTraceCPU1.setText("CPU1");
    menuTraceCPU1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuTraceCPU1ActionPerformed(evt);
        }
    });
    menuTracer.add(menuTraceCPU1);

    menuTraceCPU2.setText("CPU2");
    menuTraceCPU2.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuTraceCPU2ActionPerformed(evt);
        }
    });
    menuTracer.add(menuTraceCPU2);

    menuTraceCPU3.setText("CPU3");
    menuTraceCPU3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuTraceCPU3ActionPerformed(evt);
        }
    });
    menuTracer.add(menuTraceCPU3);

    menuService.add(menuTracer);

    menuBar.add(menuService);

    menuOptions.setText("Options");

    menuOptionsShowIndicators.setSelected(true);
    menuOptionsShowIndicators.setText("Indicator panel");
    menuOptionsShowIndicators.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/indicator.png"))); // NOI18N
    menuOptionsShowIndicators.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuOptionsShowIndicatorsActionPerformed(evt);
        }
    });
    menuOptions.add(menuOptionsShowIndicators);

    menuOptionsZX128Mode.setSelected(true);
    menuOptionsZX128Mode.setText("ZX 128 Mode");
    menuOptionsZX128Mode.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/zx128.png"))); // NOI18N
    menuOptionsZX128Mode.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuOptionsZX128ModeActionPerformed(evt);
        }
    });
    menuOptions.add(menuOptionsZX128Mode);

    menuOptionsTurbo.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F3, 0));
    menuOptionsTurbo.setSelected(true);
    menuOptionsTurbo.setText("Turbo");
    menuOptionsTurbo.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/turbo.png"))); // NOI18N
    menuOptionsTurbo.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuOptionsTurboActionPerformed(evt);
        }
    });
    menuOptions.add(menuOptionsTurbo);

    menuBar.add(menuOptions);

    menuHelp.setText("Help");

    menuHelpAbout.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
    menuHelpAbout.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/igormaznitsa/zxpoly/icons/info.png"))); // NOI18N
    menuHelpAbout.setText("About");
    menuHelpAbout.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            menuHelpAboutActionPerformed(evt);
        }
    });
    menuHelp.add(menuHelpAbout);

    menuBar.add(menuHelp);

    setJMenuBar(menuBar);

    pack();
}

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 2  s. c o  m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

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

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

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

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

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

    labelCellUnderMouse.setText("   ");

    labelZoomStatus.setText("   ");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    menuMain.add(menuFile);

    menuEdit.setText("Edit");

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

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

    menuMain.add(menuEdit);

    menuView.setText("View");

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

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

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

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

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

    menuMain.add(menuView);

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

    menuWindow.setText("Window");

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

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

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

    menuMain.add(menuWindow);

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

    menuHelp.setText("Help");

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

    menuMain.add(menuHelp);

    setJMenuBar(menuMain);

    pack();
}

From source file:at.becast.youploader.gui.FrmMain.java

public void initMenuBar() {
    JMenuBar mnuBar = new JMenuBar();
    JMenu mnuFile = new JMenu();
    JMenuItem mnuQuit = new JMenuItem();
    mnuAcc = new JMenu();

    mnuFile.setText(LANG.getString("frmMain.menu.File"));

    mnuQuit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK));
    mnuQuit.setText(LANG.getString("frmMain.menu.Quit"));
    mnuQuit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            mnuQuitActionPerformed();//from w ww .  j  av  a2  s .  c om
        }
    });
    mnuFile.add(mnuQuit);

    mnuBar.add(mnuFile);

    mnuAcc.setText(LANG.getString("frmMain.menu.Account"));
    mnuBar.add(mnuAcc);

    JSeparator separator = new JSeparator();
    JMenuItem mntmAddAccount = new JMenuItem(LANG.getString("frmMain.menu.AddAccount"));
    mntmAddAccount.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            mntmAddAccountActionPerformed();
        }
    });
    mnuAcc.add(mntmAddAccount);
    mnuAcc.add(separator);

    JMenu mnLanguage = new JMenu("Language");
    mnLanguage.setVisible(false);
    mnLanguage.setEnabled(false);
    mnuBar.add(mnLanguage);

    JMenu menu = new JMenu("?");
    mnuBar.add(menu);

    JMenuItem mntmDonate = new JMenuItem(LANG.getString("frmMain.menu.Donate"));
    menu.add(mntmDonate);
    mntmDonate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            donateButton();
        }
    });

    JMenuItem mntmAbout = new JMenuItem(LANG.getString("frmMain.menu.About"));
    mntmAbout.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            FrmAbout about = new FrmAbout();
            about.setVisible(true);
        }
    });
    menu.add(mntmAbout);

    JMenuItem mntmShowLogfile = new JMenuItem(LANG.getString("frmMain.menu.ShowLogfile"));
    mntmShowLogfile.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            DesktopUtil.openDir(new File(System.getProperty("user.home") + "/YouPloader"));
        }
    });
    menu.add(mntmShowLogfile);

    JMenuItem mntmUploadLogfile = new JMenuItem(LANG.getString("frmMain.menu.UploadLatestLogfile"));
    mntmUploadLogfile.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            DesktopUtil.openDir(new File(System.getProperty("user.home") + "/YouPloader"));
        }
    });
    menu.add(mntmUploadLogfile);

    chckbxmntmCheckForUpdates = new JCheckBoxMenuItem(LANG.getString("frmMain.menu.CheckforUpdates"));
    menu.add(chckbxmntmCheckForUpdates);
    if (Main.s.setting.get("notify_updates").equals("1")) {
        chckbxmntmCheckForUpdates.setSelected(true);
    }
    chckbxmntmCheckForUpdates.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            toggleUpdateNotifier();
        }
    });
    setJMenuBar(mnuBar);
}

From source file:org.eclipse.jubula.rc.swt.driver.RobotSwtImpl.java

/**
 * // w w w.  j a  v  a  2  s.  co  m
 * @param keyStroke The key stroke. 
 * @return a list of key typers capable of generating the necessary
 *         events to simulate the modifiers of the given key stroke.
 */
private List modifierKeyTypers(KeyStroke keyStroke) {
    List l = new LinkedList();
    int modifiers = keyStroke.getModifiers();
    // this is jdk 1.3 - code.
    // use ALT_DOWN_MASK instead etc. with jdk 1.4 !
    if ((modifiers & InputEvent.ALT_MASK) != 0) {
        l.add(new KeyCodeTyper(SWT.ALT));
    }
    if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        l.add(new KeyCodeTyper(SWT.CTRL));
    }
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        l.add(new KeyCodeTyper(SWT.SHIFT));
    }
    if ((modifiers & InputEvent.META_MASK) != 0) {
        l.add(new KeyCodeTyper(SWT.COMMAND));
    }
    return l;
}