Example usage for java.awt.event KeyEvent VK_RIGHT

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

Introduction

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

Prototype

int VK_RIGHT

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

Click Source Link

Document

Constant for the non-numpad right arrow key.

Usage

From source file:me.solhub.simple.engine.DebugLocationsStructure.java

/**
 * Switches the color of the agent from destination to group or vice versa
 * whenever the space bar is pressed/* ww  w.j a v  a2 s.c  om*/
 */
private void handleColorSwitchingInput() {
    if (_input.isKeyDown(KeyEvent.VK_SPACE) && inputDelayCount > inputDelay) {
        isDestinationColors = !isDestinationColors;
        inputDelayCount = 0;
    }
    if (_input.isKeyDown(KeyEvent.VK_PERIOD)) {
        LIVE_DELAY += 1;
        if (LIVE_DELAY < 0) {
            LIVE_DELAY = 0;
        }
    }
    if (_input.isKeyDown(KeyEvent.VK_COMMA)) {
        LIVE_DELAY -= 1;
        if (LIVE_DELAY < 0) {
            LIVE_DELAY = 0;
        }
    }
    if (_input.isKeyDown(KeyEvent.VK_UP)) {
        _yOffset += 1;
    }
    if (_input.isKeyDown(KeyEvent.VK_DOWN)) {
        _yOffset -= 1;
    }
    if (_input.isKeyDown(KeyEvent.VK_RIGHT)) {
        _xOffset -= 1;
    }
    if (_input.isKeyDown(KeyEvent.VK_LEFT)) {
        _xOffset += 1;
    }
    if (_input.isKeyDown(KeyEvent.VK_ENTER)) {
        while (!_input.isKeyDown(KeyEvent.VK_SHIFT)) {
            //this makes it work, without this line it will not work as desired
            //                System.out.println(_input.isKeyDown( KeyEvent.VK_ENTER ));
            draw();
            handleColorSwitchingInput();
        }
    }
    inputDelayCount++;
}

From source file:net.sf.maltcms.chromaui.chromatogram1Dviewer.ui.panel.Chromatogram1DHeatmapViewerPanel.java

@Override
public void keyPressed(KeyEvent ke) {
    Logger.getLogger(getClass().getName()).log(Level.INFO, "Received key event: {0}", ke.toString());
    if (ke.isControlDown()) {
        modeSpinner.setValue(InstanceContentSelectionHandler.Mode.ON_HOVER.toString());
    }/*  w  ww.  ja va 2  s  .  c om*/
    if (getDataPoint() != null) {
        Logger.getLogger(getClass().getName()).info("Data point is not null!");
        Point p = null;
        if (ke.getKeyCode() == KeyEvent.VK_RIGHT) {
            p = new Point(getDataPoint());
            p.translate(1, 0);
        } else if (ke.getKeyCode() == KeyEvent.VK_LEFT) {
            p = new Point(getDataPoint());
            p.translate(-1, 0);
        } else if (ke.getKeyCode() == KeyEvent.VK_UP) {
            p = new Point(getDataPoint());
            p.translate(0, 1);
        } else if (ke.getKeyCode() == KeyEvent.VK_DOWN) {
            p = new Point(getDataPoint());
            p.translate(0, -1);
        }
        setDataPoint(p);
        if (!ke.isShiftDown()) {
            //                triggerMSUpdate();
        }
    }
}

From source file:com.jvms.i18neditor.editor.Editor.java

private void setupGlobalKeyEventDispatcher() {
    KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(e -> {
        if (e.getID() != KeyEvent.KEY_PRESSED || !e.isAltDown() || (SystemUtils.IS_OS_MAC && !e.isMetaDown())
                || (!SystemUtils.IS_OS_MAC && !e.isShiftDown())) {
            return false;
        }/*from  w w  w.j a  va 2 s .com*/
        TreePath selected = translationTree.getSelectionPath();
        if (selected == null) {
            return false;
        }
        boolean result = false;
        int row = translationTree.getRowForPath(selected);
        switch (e.getKeyCode()) {
        case KeyEvent.VK_RIGHT:
            if (!translationTree.isExpanded(row)) {
                translationTree.expandRow(row);
            }
            result = true;
            break;
        case KeyEvent.VK_LEFT:
            if (translationTree.isCollapsed(row)) {
                translationTree.setSelectionPath(selected.getParentPath());
            } else {
                translationTree.collapseRow(row);
            }
            result = true;
            break;
        case KeyEvent.VK_UP:
            TreePath prev = translationTree.getPathForRow(Math.max(0, row - 1));
            if (prev != null) {
                translationTree.setSelectionPath(prev);
            }
            result = true;
            break;
        case KeyEvent.VK_DOWN:
            TreePath next = translationTree.getPathForRow(row + 1);
            if (next != null) {
                translationTree.setSelectionPath(next);
            }
            result = true;
            break;
        }
        if (result && !resourceFields.isEmpty()) {
            Component comp = getFocusOwner();
            if (comp != null && (comp instanceof ResourceField || comp.equals(this))) {
                TranslationTreeNode current = translationTree.getSelectionNode();
                if (!current.isLeaf() || current.isRoot()) {
                    requestFocusInWindow();
                } else if (comp.equals(this)) {
                    requestFocusInFirstResourceField();
                }
            }
        }
        return result;
    });
}

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

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

    // File menu/*  w w  w  .j  a  va2 s.c  om*/
    fileMenu = new JMenu("(F)");
    fileMenu.setMnemonic('F');

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

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

    fileMenu.addSeparator();

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

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

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

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

    viewMenu.addSeparator();

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

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

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

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

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

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

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

    editMenu.addSeparator();

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

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

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

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

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

From source file:org.yccheok.jstock.gui.charting.ChartLayerUI.java

@Override
public void processKeyEvent(java.awt.event.KeyEvent e, JXLayer<? extends V> l) {
    if (e.getID() != KeyEvent.KEY_PRESSED) {
        // We are only interested in KEY_PRESSED event.
        return;//  ww  w  . j a  va  2  s .  c o m
    }
    final int code = e.getKeyCode();
    switch (code) {
    case KeyEvent.VK_LEFT:
        this.updateTraceInfosIfPossible(-1);
        break;
    case KeyEvent.VK_RIGHT:
        this.updateTraceInfosIfPossible(+1);
        break;
    }
}

From source file:com.emental.mindraider.ui.frames.MindRaiderMainWindow.java

/**
 * Build main menu.//from  w ww . ja  v a 2  s.c o m
 * 
 * @param spiders
 */
private void buildMenu(final SpidersGraph spiders) {
    JMenuBar menuBar;
    JMenu menu, submenu;
    JMenuItem menuItem, subMenuItem;
    JRadioButtonMenuItem rbMenuItem;

    // create the menu bar
    menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    // - main menu -------------------------------------------------------
    menu = new JMenu(MindRaiderConstants.MR_TITLE);
    menu.setMnemonic(KeyEvent.VK_M);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.setActiveNotebookAsHome"));
    menuItem.setMnemonic(KeyEvent.VK_H);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            MindRaider.profile.setHomeNotebook();
        }
    });
    menu.add(menuItem);
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.preferences"));
    menuItem.setMnemonic(KeyEvent.VK_P);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            new PreferencesJDialog();
        }
    });
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.exit"), KeyEvent.VK_X);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            exitMindRaider();
        }
    });
    menu.add(menuItem);

    menuBar.add(menu);

    // - Find ----------------------------------------------------------

    menu = new JMenu(Messages.getString("MindRaiderJFrame.search"));
    menu.setMnemonic(KeyEvent.VK_F);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.searchNotebooks"));
    menuItem.setMnemonic(KeyEvent.VK_N);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK));
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            new OpenOutlineJDialog();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.searchFulltext"));
    menuItem.setMnemonic(KeyEvent.VK_F);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK));
    menuItem.setEnabled(true);
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            new FtsJDialog();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.searchConceptsInNotebook"));
    menuItem.setMnemonic(KeyEvent.VK_C);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK));
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (MindRaider.profile.getActiveOutlineUri() != null) {
                new OpenNoteJDialog();
            }
        }
    });
    menu.add(menuItem);

    // search by tag
    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.searchConceptsByTag"));
    menuItem.setEnabled(true);
    menuItem.setMnemonic(KeyEvent.VK_T);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK));
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            new OpenConceptByTagJDialog();
        }
    });
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.previousNote"));
    menuItem.setEnabled(true);
    menuItem.setMnemonic(KeyEvent.VK_P);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, ActionEvent.ALT_MASK));
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            MindRaider.recentConcepts.moveOneNoteBack();
        }
    });
    menu.add(menuItem);

    // global RDF search
    //        menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.searchRdql"));
    //        menuItem.setEnabled(false);
    //        menuItem.setMnemonic(KeyEvent.VK_R);
    //        menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R,
    //                ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK));
    //        menuItem.addActionListener(new ActionListener() {
    //
    //            public void actionPerformed(ActionEvent e) {
    //                // TODO rdql to be implemented
    //            }
    //        });
    //        menu.add(menuItem);

    menuBar.add(menu);

    // - view ------------------------------------------------------------
    menu = new JMenu(Messages.getString("MindRaiderJFrame.view"));
    menu.setMnemonic(KeyEvent.VK_V);

    // TODO localize L&F menu
    ButtonGroup lfGroup = new ButtonGroup();
    submenu = new JMenu(Messages.getString("MindRaiderJFrame.lookAndFeel"));
    logger.debug("Look and feel is: " + MindRaider.profile.getLookAndFeel()); // {{debug}}
    submenu.setMnemonic(KeyEvent.VK_L);
    subMenuItem = new JRadioButtonMenuItem(Messages.getString("MindRaiderJFrame.lookAndFeelNative"));
    if (MindRaider.LF_NATIVE.equals(MindRaider.profile.getLookAndFeel())) {
        subMenuItem.setSelected(true);
    }
    subMenuItem.setEnabled(true);
    subMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setLookAndFeel(MindRaider.LF_NATIVE);
        }
    });
    submenu.add(subMenuItem);
    lfGroup.add(subMenuItem);
    subMenuItem = new JRadioButtonMenuItem(Messages.getString("MindRaiderJFrame.lookAndFeelJava"));
    if (MindRaider.LF_JAVA_DEFAULT.equals(MindRaider.profile.getLookAndFeel())) {
        subMenuItem.setSelected(true);
    }
    subMenuItem.setEnabled(true);
    subMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            setLookAndFeel(MindRaider.LF_JAVA_DEFAULT);
        }
    });
    submenu.add(subMenuItem);
    lfGroup.add(subMenuItem);
    menu.add(submenu);

    menu.addSeparator();
    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.leftSideBar"));
    menuItem.setMnemonic(KeyEvent.VK_L);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (leftSidebarSplitPane.getDividerLocation() == 1) {
                leftSidebarSplitPane.resetToPreferredSizes();
            } else {
                closeLeftSidebar();
            }
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.rightSideBar"));
    menuItem.setMnemonic(KeyEvent.VK_R);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            OutlineJPanel.getInstance().toggleRightSidebar();
        }
    });
    menu.add(menuItem);

    // TODO tips to be implemented
    // JCheckBoxMenuItem helpCheckbox=new JCheckBoxMenuItem("Tips",true);
    // menu.add(helpCheckbox);

    // TODO localize
    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.toolbar"));
    menuItem.setMnemonic(KeyEvent.VK_T);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            MindRaider.masterToolBar.toggleVisibility();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.rdfNavigatorDashboard"));
    menuItem.setMnemonic(KeyEvent.VK_D);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            MindRaider.spidersGraph.getGlPanel().toggleControlPanel();
        }
    });
    menu.add(menuItem);

    JCheckBoxMenuItem checkboxMenuItem;
    ButtonGroup colorSchemeGroup;

    //        if (!MindRaider.OUTLINER_PERSPECTIVE.equals(MindRaider.profile
    //                .getUiPerspective())) {

    menu.addSeparator();

    // Facets
    submenu = new JMenu(Messages.getString("MindRaiderJFrame.facet"));
    submenu.setMnemonic(KeyEvent.VK_F);
    colorSchemeGroup = new ButtonGroup();

    String[] facetLabels = FacetCustodian.getInstance().getFacetLabels();
    if (!ArrayUtils.isEmpty(facetLabels)) {
        for (String facetLabel : facetLabels) {
            rbMenuItem = new JRadioButtonMenuItem(facetLabel);
            rbMenuItem.addActionListener(new FacetActionListener(facetLabel));
            colorSchemeGroup.add(rbMenuItem);
            submenu.add(rbMenuItem);
            if (BriefFacet.LABEL.equals(facetLabel)) {
                rbMenuItem.setSelected(true);
            }
        }

    }
    menu.add(submenu);

    checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.graphLabelAsUri"));
    checkboxMenuItem.setMnemonic(KeyEvent.VK_G);
    checkboxMenuItem.setState(MindRaider.spidersGraph.isUriLabels());
    checkboxMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof JCheckBoxMenuItem) {
                JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource();
                MindRaider.spidersGraph.setUriLabels(j.getState());
                MindRaider.spidersGraph.renderModel();
                MindRaider.profile.setGraphShowLabelsAsUris(j.getState());
                MindRaider.profile.save();
            }
        }
    });

    menu.add(checkboxMenuItem);

    checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.predicateNodes"));
    checkboxMenuItem.setMnemonic(KeyEvent.VK_P);
    checkboxMenuItem.setState(!MindRaider.spidersGraph.getHidePredicates());
    checkboxMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof JCheckBoxMenuItem) {
                JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource();
                MindRaider.spidersGraph.hidePredicates(!j.getState());
                MindRaider.spidersGraph.renderModel();
                MindRaider.profile.setGraphHidePredicates(!j.getState());
                MindRaider.profile.save();
            }
        }
    });
    menu.add(checkboxMenuItem);

    checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.multilineLabels"));
    checkboxMenuItem.setMnemonic(KeyEvent.VK_M);
    checkboxMenuItem.setState(MindRaider.spidersGraph.isMultilineNodes());
    checkboxMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof JCheckBoxMenuItem) {
                JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource();
                MindRaider.spidersGraph.setMultilineNodes(j.getState());
                MindRaider.spidersGraph.renderModel();
                MindRaider.profile.setGraphMultilineLabels(j.getState());
                MindRaider.profile.save();
            }
        }
    });
    menu.add(checkboxMenuItem);
    //        }

    menu.addSeparator();

    // Antialias
    checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.antiAliased"), true);
    checkboxMenuItem.setMnemonic(KeyEvent.VK_A);
    checkboxMenuItem.setState(SpidersGraph.antialiased);
    checkboxMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof JCheckBoxMenuItem) {
                JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource();
                SpidersGraph.antialiased = j.getState();
                MindRaider.spidersGraph.renderModel();
            }
        }
    });
    menu.add(checkboxMenuItem);

    // Enable hyperbolic
    checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.hyperbolic"), true);
    checkboxMenuItem.setMnemonic(KeyEvent.VK_H);
    checkboxMenuItem.setState(SpidersGraph.hyperbolic);
    checkboxMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof JCheckBoxMenuItem) {
                JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource();
                SpidersGraph.hyperbolic = j.getState();
                MindRaider.spidersGraph.renderModel();
            }
        }
    });
    menu.add(checkboxMenuItem);

    // Show FPS
    checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.fps"), true);
    checkboxMenuItem.setMnemonic(KeyEvent.VK_F);
    checkboxMenuItem.setState(SpidersGraph.fps);
    checkboxMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof JCheckBoxMenuItem) {
                JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource();
                SpidersGraph.fps = j.getState();
                MindRaider.spidersGraph.renderModel();
            }
        }
    });
    menu.add(checkboxMenuItem);

    // Graph color scheme
    submenu = new JMenu(Messages.getString("MindRaiderJFrame.colorScheme"));
    submenu.setMnemonic(KeyEvent.VK_C);
    String[] allProfilesUris = MindRaider.spidersColorProfileRegistry.getAllProfilesUris();
    colorSchemeGroup = new ButtonGroup();
    for (int i = 0; i < allProfilesUris.length; i++) {
        rbMenuItem = new UriJRadioButtonMenuItem(
                MindRaider.spidersColorProfileRegistry.getColorProfileByUri(allProfilesUris[i]).getLabel(),
                allProfilesUris[i]);
        rbMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (e.getSource() instanceof UriJRadioButtonMenuItem) {
                    MindRaider.spidersColorProfileRegistry
                            .setCurrentProfile(((UriJRadioButtonMenuItem) e.getSource()).uri);
                    MindRaider.spidersGraph
                            .setRenderingProfile(MindRaider.spidersColorProfileRegistry.getCurrentProfile());
                    MindRaider.spidersGraph.renderModel();
                }
            }
        });
        colorSchemeGroup.add(rbMenuItem);
        submenu.add(rbMenuItem);
    }
    menu.add(submenu);

    // Annotation color scheme
    submenu = new JMenu(Messages.getString("MindRaiderJFrame.colorSchemeAnnotation"));
    submenu.setMnemonic(KeyEvent.VK_A);
    allProfilesUris = MindRaider.annotationColorProfileRegistry.getAllProfilesUris();
    colorSchemeGroup = new ButtonGroup();
    for (int i = 0; i < allProfilesUris.length; i++) {
        rbMenuItem = new UriJRadioButtonMenuItem(
                MindRaider.annotationColorProfileRegistry.getColorProfileByUri(allProfilesUris[i]).getLabel(),
                allProfilesUris[i]);
        rbMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (e.getSource() instanceof UriJRadioButtonMenuItem) {
                    MindRaider.annotationColorProfileRegistry
                            .setCurrentProfile(((UriJRadioButtonMenuItem) e.getSource()).uri);
                    OutlineJPanel.getInstance().conceptJPanel.refresh();
                }
            }
        });
        colorSchemeGroup.add(rbMenuItem);
        submenu.add(rbMenuItem);
    }
    menu.add(submenu);

    menu.addSeparator();

    checkboxMenuItem = new JCheckBoxMenuItem(Messages.getString("MindRaiderJFrame.fullScreen"));
    checkboxMenuItem.setMnemonic(KeyEvent.VK_U);
    checkboxMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0));
    checkboxMenuItem.setState(false);
    checkboxMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (e.getSource() instanceof JCheckBoxMenuItem) {
                JCheckBoxMenuItem j = (JCheckBoxMenuItem) e.getSource();
                if (j.getState()) {
                    Gfx.toggleFullScreen(MindRaiderMainWindow.this);
                } else {
                    Gfx.toggleFullScreen(null);
                }
            }
        }
    });
    menu.add(checkboxMenuItem);

    menuBar.add(menu);

    // - outline
    // ----------------------------------------------------------------------
    menu = new JMenu(Messages.getString("MindRaiderJFrame.notebook"));
    menu.setMnemonic(KeyEvent.VK_N);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.newNotebook"));
    menuItem.setMnemonic(KeyEvent.VK_N);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            // TODO clear should be optional - only if creation finished
            // MindRider.spidersGraph.clear();
            new NewOutlineJDialog();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.open"));
    menuItem.setMnemonic(KeyEvent.VK_O);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK));
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            new OpenOutlineJDialog();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.close"));
    menuItem.setMnemonic(KeyEvent.VK_C);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            MindRaider.outlineCustodian.close();
            OutlineJPanel.getInstance().refresh();
            MindRaider.spidersGraph.renderModel();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.discard"));
    menuItem.setMnemonic(KeyEvent.VK_D);
    menuItem.setEnabled(false); // TODO discard method must be implemented
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            int result = JOptionPane.showConfirmDialog(MindRaiderMainWindow.this, Messages.getString(
                    "MindRaiderJFrame.confirmDiscardNotebook", MindRaider.profile.getActiveOutline()));
            if (result == JOptionPane.YES_OPTION) {
                if (MindRaider.profile.getActiveOutlineUri() != null) {
                    try {
                        MindRaider.labelCustodian
                                .discardOutline(MindRaider.profile.getActiveOutlineUri().toString());
                        MindRaider.outlineCustodian.close();
                    } catch (Exception e1) {
                        logger.error(Messages.getString("MindRaiderJFrame.unableToDiscardNotebook"), e1);
                    }
                }
            }
        }
    });
    menu.add(menuItem);

    menu.addSeparator();

    // export
    submenu = new JMenu(Messages.getString("MindRaiderJFrame.export"));
    submenu.setMnemonic(KeyEvent.VK_E);
    // Atom
    subMenuItem = new JMenuItem("Atom");
    subMenuItem.setEnabled(true);
    subMenuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            exportActiveOutlineToAtom();
        }
    });
    submenu.add(subMenuItem);

    // OPML
    subMenuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.opml"));
    subMenuItem.setEnabled(true);
    subMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (MindRaider.profile.getActiveOutline() == null) {
                JOptionPane.showMessageDialog(MindRaiderMainWindow.this,
                        Messages.getString("MindRaiderJFrame.exportNotebookWarning"),
                        Messages.getString("MindRaiderJFrame.exportError"),

                        JOptionPane.ERROR_MESSAGE);
                return;
            }

            JFileChooser fc = new JFileChooser();
            fc.setApproveButtonText(Messages.getString("MindRaiderJFrame.export"));
            fc.setControlButtonsAreShown(true);
            fc.setDialogTitle(Messages.getString("MindRaiderJFrame.chooseExportDirectory"));
            fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            // prepare directory
            String exportDirectory = MindRaider.profile.getHomeDirectory() + File.separator + "export"
                    + File.separator + "opml";
            Utils.createDirectory(exportDirectory);
            fc.setCurrentDirectory(new File(exportDirectory));
            int returnVal = fc.showOpenDialog(MindRaiderMainWindow.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                String dstFileName = fc.getSelectedFile().getAbsolutePath() + File.separator + "OPML-EXPORT-"
                        + MindRaider.outlineCustodian.getActiveNotebookNcName() + ".xml";
                logger.debug(Messages.getString("MindRaiderJFrame.exportingToFile", dstFileName));
                MindRaider.outlineCustodian.exportOutline(OutlineCustodian.FORMAT_OPML, dstFileName);
                Launcher.launchViaStart(dstFileName);
            } else {
                logger.debug(Messages.getString("MindRaiderJFrame.exportCommandCancelledByUser"));
            }
        }
    });
    submenu.add(subMenuItem);
    // TWiki
    subMenuItem = new JMenuItem("TWiki");
    subMenuItem.setEnabled(true);
    subMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (MindRaider.profile.getActiveOutline() == null) {
                JOptionPane.showMessageDialog(MindRaiderMainWindow.this,
                        Messages.getString("MindRaiderJFrame.exportNotebookWarning"),
                        Messages.getString("MindRaiderJFrame.exportError"), JOptionPane.ERROR_MESSAGE);
                return;
            }

            JFileChooser fc = new JFileChooser();
            fc.setApproveButtonText(Messages.getString("MindRaiderJFrame.export"));
            fc.setControlButtonsAreShown(true);
            fc.setDialogTitle(Messages.getString("MindRaiderJFrame.chooseExportDirectory"));
            fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            // prepare directory
            String exportDirectory = MindRaider.profile.getHomeDirectory() + File.separator + "export"
                    + File.separator + "twiki";
            Utils.createDirectory(exportDirectory);
            fc.setCurrentDirectory(new File(exportDirectory));
            int returnVal = fc.showOpenDialog(MindRaiderMainWindow.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                final String dstFileName = fc.getSelectedFile().getAbsolutePath() + File.separator
                        + "TWIKI-EXPORT-" + MindRaider.outlineCustodian.getActiveNotebookNcName() + ".txt";
                logger.debug(Messages.getString("MindRaiderJFrame.exportingToFile", dstFileName));

                MindRaider.outlineCustodian.exportOutline(OutlineCustodian.FORMAT_TWIKI, dstFileName);
            } else {
                logger.debug(Messages.getString("MindRaiderJFrame.exportCommandCancelledByUser"));
            }
        }
    });
    submenu.add(subMenuItem);

    menu.add(submenu);

    // import
    submenu = new JMenu(Messages.getString("MindRaiderJFrame.import"));
    submenu.setMnemonic(KeyEvent.VK_I);

    subMenuItem = new JMenuItem("Atom");
    subMenuItem.setEnabled(true);
    subMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            importFromAtom();
        }
    });
    submenu.add(subMenuItem);

    // TWiki
    subMenuItem = new JMenuItem("TWiki");
    subMenuItem.setEnabled(true);
    subMenuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            // choose file to be transformed
            OutlineJPanel.getInstance().clear();
            MindRaider.profile.setActiveOutlineUri(null);
            JFileChooser fc = new JFileChooser();
            int returnVal = fc.showOpenDialog(MindRaiderMainWindow.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                final File file = fc.getSelectedFile();
                MindRaider.profile.deleteActiveModel();
                logger.debug(
                        Messages.getString("MindRaiderJFrame.importingTWikiTopic", file.getAbsolutePath()));

                // perform it async
                final SwingWorker worker = new SwingWorker() {

                    public Object construct() {
                        ProgressDialogJFrame progressDialogJFrame = new ProgressDialogJFrame(
                                Messages.getString("MindRaiderJFrame.twikiImport"),
                                Messages.getString("MindRaiderJFrame.processingTopicTWiki"));
                        try {
                            MindRaider.outlineCustodian.importNotebook(OutlineCustodian.FORMAT_TWIKI,
                                    (file != null ? file.getAbsolutePath() : null), progressDialogJFrame);
                        } finally {
                            if (progressDialogJFrame != null) {
                                progressDialogJFrame.dispose();
                            }
                        }
                        return null;
                    }
                };
                worker.start();
            } else {
                logger.debug(Messages.getString("MindRaiderJFrame.openCommandCancelledByUser"));
            }
        }
    });
    submenu.add(subMenuItem);

    menu.add(submenu);

    menuBar.add(menu);

    // - note
    // ----------------------------------------------------------------------
    menu = new JMenu(Messages.getString("MindRaiderJFrame.concept"));
    menu.setMnemonic(KeyEvent.VK_C);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.new"));
    menuItem.setMnemonic(KeyEvent.VK_N);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            OutlineJPanel.getInstance().newConcept();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.open"));
    menuItem.setMnemonic(KeyEvent.VK_O);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK));
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (MindRaider.profile.getActiveOutlineUri() != null) {
                new OpenNoteJDialog();
            }
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.discard"));
    // do not accelerate this command with DEL - it's already handled
    // elsewhere
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
    menuItem.setMnemonic(KeyEvent.VK_D);
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            OutlineJPanel.getInstance().conceptDiscard();
        }
    });
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.up"));
    menuItem.setMnemonic(KeyEvent.VK_U);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_UP, ActionEvent.CTRL_MASK));
    menuItem.setEnabled(true);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            OutlineJPanel.getInstance().conceptUp();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.promote"));
    menuItem.setMnemonic(KeyEvent.VK_P);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, ActionEvent.CTRL_MASK));
    menuItem.setEnabled(true);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            OutlineJPanel.getInstance().conceptPromote();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.demote"));
    menuItem.setMnemonic(KeyEvent.VK_D);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, ActionEvent.CTRL_MASK));
    menuItem.setEnabled(true);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            OutlineJPanel.getInstance().conceptDemote();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.down"));
    menuItem.setMnemonic(KeyEvent.VK_O);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, ActionEvent.CTRL_MASK));
    menuItem.setEnabled(true);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            OutlineJPanel.getInstance().conceptDown();
        }
    });
    menu.add(menuItem);

    menuBar.add(menu);

    // - Tools -----------------------------------------------------------

    menu = new JMenu(Messages.getString("MindRaiderJFrame.tools"));
    menu.setMnemonic(KeyEvent.VK_T);

    menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.checkAndFix"));
    menuItem.setMnemonic(KeyEvent.VK_F);
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Checker.checkAndFixRepositoryAsync();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.backupRepository"));
    menuItem.setMnemonic(KeyEvent.VK_B);
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Installer.backupRepositoryAsync();
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.rebuildSearchIndex"));
    menuItem.setMnemonic(KeyEvent.VK_R);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            SearchCommander.rebuildSearchAndTagIndices();
        }
    });
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.captureScreen"));
    menuItem.setMnemonic(KeyEvent.VK_S);
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = new JFileChooser();
            fc.setApproveButtonText(Messages.getString("MindRaiderJFrame.screenshot"));
            fc.setControlButtonsAreShown(true);
            fc.setDialogTitle(Messages.getString("MindRaiderJFrame.chooseScreenshotDirectory"));
            fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            // prepare directory
            String exportDirectory = MindRaider.profile.getHomeDirectory() + File.separator + "Screenshots";
            Utils.createDirectory(exportDirectory);
            fc.setCurrentDirectory(new File(exportDirectory));
            int returnVal = fc.showOpenDialog(MindRaiderMainWindow.this);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                final String filename = fc.getSelectedFile().getAbsolutePath() + File.separator
                        + "screenshot.jpg";

                // do it in async (redraw screen)
                Thread thread = new Thread() {
                    public void run() {
                        OutputStream file = null;
                        try {
                            file = new FileOutputStream(filename);

                            Robot robot = new Robot();
                            robot.delay(1000);

                            JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(file);
                            encoder.encode(robot.createScreenCapture(
                                    new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())));
                        } catch (Exception e1) {
                            logger.error("Unable to capture screen!", e1);
                        } finally {
                            if (file != null) {
                                try {
                                    file.close();
                                } catch (IOException e1) {
                                    logger.error("Unable to close stream", e1);
                                }
                            }
                        }
                    }
                };
                thread.setDaemon(true);
                thread.start();

            }
        }
    });
    menu.add(menuItem);

    menuBar.add(menu);

    // - MindForger -----------------------------------------------------------

    menu = new JMenu(Messages.getString("MindRaiderMainWindow.menuMindForger"));
    menu.setMnemonic(KeyEvent.VK_O);
    //menu.setIcon(IconsRegistry.getImageIcon("tasks-internet.png"));

    menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.menuMindForgerVideoTutorial"));
    menuItem.setMnemonic(KeyEvent.VK_G);
    menuItem.setToolTipText("http://mindraider.sourceforge.net/mindforger.html");
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Launcher.launchInBrowser("http://mindraider.sourceforge.net/mindforger.html");
        }
    });
    menuItem.setEnabled(true);
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.signUp"));
    menuItem.setMnemonic(KeyEvent.VK_S);
    menuItem.setToolTipText("http://www.mindforger.com");
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Launcher.launchInBrowser("http://www.mindforger.com");
        }
    });
    menuItem.setEnabled(true);
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.menuMindForgerUpload"));
    menuItem.setMnemonic(KeyEvent.VK_U);
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // fork in order to enable status updates in the main window
            new MindForgerUploadOutlineJDialog();
        }
    });
    menuItem.setEnabled(true);
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.menuMindForgerDownload"));
    menuItem.setMnemonic(KeyEvent.VK_U);
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            downloadAnOutlineFromMindForger();
        }
    });
    menuItem.setEnabled(true);
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.menuMindForgerMyOutlines"));
    menuItem.setMnemonic(KeyEvent.VK_O);
    menuItem.setEnabled(true);
    menuItem.setToolTipText("http://web.mindforger.com");
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Launcher.launchInBrowser("http://web.mindforger.com");
        }
    });
    menu.add(menuItem);

    menuBar.add(menu);

    // - align Help on right -------------------------------------------------------------

    menuBar.add(Box.createHorizontalGlue());

    // - help -------------------------------------------------------------
    menu = new JMenu(Messages.getString("MindRaiderJFrame.help"));
    menu.setMnemonic(KeyEvent.VK_H);

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.documentation"));
    menuItem.setMnemonic(KeyEvent.VK_D);
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                MindRaider.outlineCustodian.loadOutline(new URI(MindRaiderVocabulary
                        .getNotebookUri(OutlineCustodian.MR_DOC_NOTEBOOK_DOCUMENTATION_LOCAL_NAME)));
                OutlineJPanel.getInstance().refresh();
            } catch (Exception e1) {
                logger.error(Messages.getString("MindRaiderJFrame.unableToLoadHelp", e1.getMessage()));
            }
        }
    });
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.webHomepage"));
    menuItem.setMnemonic(KeyEvent.VK_H);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            Launcher.launchInBrowser("http://mindraider.sourceforge.net");
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.reportBug"));
    menuItem.setMnemonic(KeyEvent.VK_R);
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Launcher.launchInBrowser("http://sourceforge.net/forum/?group_id=128454");
        }
    });
    menu.add(menuItem);

    menuItem = new JMenuItem(Messages.getString("MindRaiderMainWindow.updateCheck"));
    menuItem.setMnemonic(KeyEvent.VK_F);
    menuItem.setEnabled(true);
    menuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // just open html page at:
            //   http://mindraider.sourceforge.net/update-7.2.html
            // this page will either contain "you have the last version" or will ask user to
            // download the latest version from main page
            Launcher.launchInBrowser("http://mindraider.sourceforge.net/" + "update-"
                    + MindRaiderConstants.majorVersion + "." + MindRaiderConstants.minorVersion + ".html");
        }
    });
    menu.add(menuItem);

    menu.addSeparator();

    menuItem = new JMenuItem(Messages.getString("MindRaiderJFrame.about", MindRaiderConstants.MR_TITLE));
    menuItem.setMnemonic(KeyEvent.VK_A);
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            new AboutJDialog();
        }
    });
    menu.add(menuItem);

    menuBar.add(menu);
}

From source file:corelyzer.ui.CorelyzerGLCanvas.java

public void keyPressed(final KeyEvent event) {
    canvasLock.lock();//from w  w  w. j  a v a  2  s  .  c om

    char key = event.getKeyChar();
    if (key == '+' || key == '=' || key == '-') { // Zoom
        float dS = 1.33f;
        float scale = 1.0f;
        float[] cp = { 0.0f, 0.0f };
        float[] sc = { 0.0f, 0.0f };

        Point mousePos = canvas.getMousePosition();

        this.convertMousePointToSceneSpace(mousePos, cp);
        sc[0] = SceneGraph.getSceneCenterX();
        sc[1] = SceneGraph.getSceneCenterY();

        switch (key) {
        case '+':
        case '=':
            scale = 1 / dS;
            break;

        case '-':
            scale = dS;
            break;
        }

        SceneGraph.scaleScene(scale);

        float ncp[] = { 0.0f, 0.0f };
        this.convertMousePointToSceneSpace(mousePos, ncp);

        ncp[0] = ncp[0] - cp[0];
        ncp[1] = ncp[1] - cp[1];

        SceneGraph.panScene(-ncp[0], -ncp[1]);
    } else if (key == 'j' || key == 'J') {
        CorelyzerApp app = CorelyzerApp.getApp();
        app.getMainFrame().setAlwaysOnTop(false);

        String inputValue = JOptionPane.showInputDialog(getPopupParent(),
                "Please input the depth to jump to in meters: ");

        app.getMainFrame().setAlwaysOnTop(true);

        if (inputValue == null) {
            return;
        }

        try {
            float depthValue = Float.parseFloat(inputValue);
            float dpix = SceneGraph.getCanvasDPIX(this.canvasId);
            float dpiy = SceneGraph.getCanvasDPIY(this.canvasId);

            float px, py;
            if (SceneGraph.getDepthOrientation()) {
                px = depthValue * 100.0f / 2.54f * dpix;
                py = 0;
            } else {
                px = 0;
                py = depthValue * 100.0f / 2.54f * dpiy;
            }

            SceneGraph.lock();
            {
                SceneGraph.positionScene(px, py);
            }
            SceneGraph.unlock();
        } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(getPopupParent(), "Please type in a number", "Alert",
                    JOptionPane.ERROR_MESSAGE);
        }
    } else if (key == KeyEvent.VK_OPEN_BRACKET || key == KeyEvent.VK_CLOSE_BRACKET || key == '9'
            || key == '0') {
        // graph scaling
        float dS = 1.00f;

        if (key == KeyEvent.VK_OPEN_BRACKET || key == '9') {
            dS = 1.0f / 1.33f;
        } else if (key == KeyEvent.VK_CLOSE_BRACKET || key == '0') {
            dS = 1.33f;
        }

        SceneGraph.setGraphScale(dS);
        // SceneGraph.setMarkerScale(dS);
    } else if (key == 'D') { // Show onscreen debug information in
        // scenegraph
        boolean b = SceneGraph.getDebug();
        SceneGraph.setDebug(!b);
    } else if (key == 'Q' || key == 'W' || key == 'E' || key == 'R') {
        int keyId = 0;
        if (key == 'Q')
            keyId = 1; // scaling
        if (key == 'W')
            keyId = 2; // labels
        if (key == 'E')
            keyId = 3; // border
        else if (key == 'R')
            keyId = 4; // scissoring
        SceneGraph.debugKey(keyId);
    } else { // pan
        float movX = 0.0f;
        float movY = 0.0f;

        int dX = 10;
        int dY = 10;

        float sx, sy;
        float w, h;

        w = SceneGraph.getCanvasWidth(canvasId);
        h = SceneGraph.getCanvasHeight(canvasId);

        sx = w / canvas.getWidth();
        sy = h / canvas.getHeight();

        switch (event.getKeyCode()) {
        case KeyEvent.VK_UP:
            movX = 0.0f;
            movY = -dY * sy;
            break;

        case KeyEvent.VK_DOWN:
            movX = 0.0f;
            movY = dY * sy;
            break;

        case KeyEvent.VK_LEFT:
            movX = -dX * sx;
            movY = 0.0f;
            break;

        case KeyEvent.VK_RIGHT:
            movX = dX * sx;
            movY = 0.0f;
            break;
        }

        SceneGraph.panScene(movX, movY);
    }

    canvasLock.unlock();
    CorelyzerApp.getApp().updateGLWindows();
}

From source file:ch.zhaw.iamp.rct.ui.GrammarWindow.java

private boolean isArrowKeyCode(int keyCode) {
    return keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_RIGHT
            || keyCode == KeyEvent.VK_DOWN;
}

From source file:org.yccheok.jstock.gui.charting.InvestmentFlowLayerUI.java

@Override
public void processKeyEvent(java.awt.event.KeyEvent e, JXLayer<? extends V> l) {
    if (e.getID() != KeyEvent.KEY_PRESSED) {
        // We are only interested in KEY_PRESSED event.
        return;//  w ww .  ja v  a2  s.com
    }
    final int code = e.getKeyCode();
    switch (code) {
    case KeyEvent.VK_LEFT:
        this.updatePointAndIndexIfPossible(-1);
        break;
    case KeyEvent.VK_RIGHT:
        this.updatePointAndIndexIfPossible(+1);
        break;
    case KeyEvent.VK_UP:
        // Switch to another stock.
        this.investmentFlowChartJDialog.selectPreviousJComboBoxSelection();
        break;
    case KeyEvent.VK_DOWN:
        // Switch to another stock.
        this.investmentFlowChartJDialog.selectNextJComboBoxSelection();
        break;
    }
}

From source file:com.sshtools.sshterm.emulation.TerminalEmulation.java

public void keyPressed(int keyCode, char keyChar, int modifiers) {
    if (debug > 0) {
        System.out.println("keyPressed(" + keyCode + "," + keyChar + "," + modifiers);
    }/*  w  w  w .ja  v a 2s  .  com*/
    boolean control = (modifiers & VDUInput.KEY_CONTROL) != 0;
    boolean shift = (modifiers & VDUInput.KEY_SHIFT) != 0;
    boolean alt = (modifiers & VDUInput.KEY_ALT) != 0;
    int xind;
    String[] fmap;
    xind = 0;
    fmap = FunctionKey;
    if (shift) {
        fmap = FunctionKeyShift;
        xind = 1;
    }
    if (control) {
        fmap = FunctionKeyCtrl;
        xind = 2;
    }
    if (alt) {
        fmap = FunctionKeyAlt;
        xind = 3;
    }
    switch (keyCode) {
    case KeyEvent.VK_PAUSE:
        if (shift || control) {
            sendTelnetCommand((byte) 243);
        }

        // BREAK
        break;
    case KeyEvent.VK_ESCAPE:
        writeSpecial(Escape[xind]);
        break;
    case KeyEvent.VK_F1:
        writeSpecial(fmap[1]);
        break;
    case KeyEvent.VK_F2:
        writeSpecial(fmap[2]);
        break;
    case KeyEvent.VK_F3:
        writeSpecial(fmap[3]);
        break;
    case KeyEvent.VK_F4:
        writeSpecial(fmap[4]);
        break;
    case KeyEvent.VK_F5:
        writeSpecial(fmap[5]);
        break;
    case KeyEvent.VK_F6:
        writeSpecial(fmap[6]);
        break;
    case KeyEvent.VK_F7:
        writeSpecial(fmap[7]);
        break;
    case KeyEvent.VK_F8:
        writeSpecial(fmap[8]);
        break;
    case KeyEvent.VK_F9:
        writeSpecial(fmap[9]);
        break;
    case KeyEvent.VK_F10:
        writeSpecial(fmap[10]);
        break;
    case KeyEvent.VK_F11:
        writeSpecial(fmap[11]);
        break;
    case KeyEvent.VK_F12:
        writeSpecial(fmap[12]);
        break;
    case KeyEvent.VK_UP:
        writeSpecial(KeyUp[xind]);
        break;
    case KeyEvent.VK_DOWN:
        writeSpecial(KeyDown[xind]);
        break;
    case KeyEvent.VK_LEFT:
        writeSpecial(KeyLeft[xind]);
        break;
    case KeyEvent.VK_RIGHT:
        writeSpecial(KeyRight[xind]);
        break;
    case KeyEvent.VK_PAGE_DOWN:
        writeSpecial(NextScn[xind]);
        break;
    case KeyEvent.VK_PAGE_UP:
        writeSpecial(PrevScn[xind]);
        break;
    case KeyEvent.VK_INSERT:
        writeSpecial(Insert[xind]);
        break;
    case KeyEvent.VK_DELETE:
        writeSpecial(Remove[xind]);
        break;
    case KeyEvent.VK_BACK_SPACE:
        writeSpecial(BackSpace[xind]);
        if (localecho) {
            if (BackSpace[xind] == "\b" || BackSpace[xind] == "\u007f") {
                putString("\b \b");
                // make the last char 'deleted'
            } else {
                putString(BackSpace[xind]);
                // echo it
            }
        }
        break;
    case KeyEvent.VK_HOME:
        writeSpecial(KeyHome[xind]);
        break;
    case KeyEvent.VK_END:
        writeSpecial(KeyEnd[xind]);
        break;
    case KeyEvent.VK_NUM_LOCK:
        if (vms && control) {
            writeSpecial(PF1);
        }
        if (!control) {
            numlock = !numlock;
        }
        break;
    case KeyEvent.VK_CAPS_LOCK:
        capslock = !capslock;
        return;
    case KeyEvent.VK_SHIFT:
    case KeyEvent.VK_CONTROL:
    case KeyEvent.VK_ALT:
        return;
    default:
        break;
    }
}