Example usage for java.awt.event KeyEvent VK_V

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

Introduction

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

Prototype

int VK_V

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

Click Source Link

Document

Constant for the "V" key.

Usage

From source file:com.AandR.beans.plotting.imagePlotPanel.CanvasPanel.java

private void createPopupMenu() {
    popupMenu = new JPopupMenu();
    popupMenu.add(createPopupMenuItem("Toggle Log Plot", null, KeyStroke.getKeyStroke(KeyEvent.VK_L, 0)));
    popupMenu.add(createPopupMenuItem("Slice Here", null, KeyStroke.getKeyStroke(KeyEvent.VK_C, 10)));
    popupMenu.addSeparator();//from w ww  . j  a  v a2 s  .co m

    JMenu navigateMenu = new JMenu("Navigate");
    navigateMenu.add(createPopupMenuItem("View First Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_F, 2)));
    navigateMenu
            .add(createPopupMenuItem("View Previous Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_P, 2)));
    navigateMenu
            .add(createPopupMenuItem("Choose Frame To View", null, KeyStroke.getKeyStroke(KeyEvent.VK_C, 2)));
    navigateMenu.add(createPopupMenuItem("View Next Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_N, 2)));
    navigateMenu.add(createPopupMenuItem("View Last Frame", null, KeyStroke.getKeyStroke(KeyEvent.VK_L, 2)));
    popupMenu.add(navigateMenu);
    popupMenu.addSeparator();

    popupMenu.add(createPopupMenuItem("Set Zoom Level", null, KeyStroke.getKeyStroke(KeyEvent.VK_Z, 2)));
    popupMenu.add(createPopupMenuItem("Set Min/Max", null, KeyStroke.getKeyStroke(KeyEvent.VK_R, 2)));
    popupMenu.add(createPopupMenuItem("Set Physical Extent", null, KeyStroke.getKeyStroke(KeyEvent.VK_E, 2)));
    popupMenu.addSeparator();
    popupMenu.add(createPopupMenuItem("Recenter on Viewport", null, KeyStroke.getKeyStroke(KeyEvent.VK_C, 0)));
    popupMenu.addSeparator();
    popupMenu.add(createPopupMenuItem("Set Colormap", null, KeyStroke.getKeyStroke(KeyEvent.VK_M, 2)));
    popupMenu.addSeparator();

    JMenu overlayMenu = new JMenu("Overlays");
    overlayMenu.add(createPopupMenuItem("Add Text Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_T, 2)));
    overlayMenu.add(createPopupMenuItem("Add Shape Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_O, 2)));
    overlayMenu.add(createPopupMenuItem("Add Annulus Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_U, 2)));
    overlayMenu.add(createPopupMenuItem("Add Arrow Overlay", null, KeyStroke.getKeyStroke(KeyEvent.VK_A, 2)));
    popupMenu.add(overlayMenu);
    popupMenu.addSeparator();

    JMenu pngMenu = new JMenu("To PNG");
    pngMenu.add(createPopupMenuItem("Export Original Image", null, KeyStroke.getKeyStroke(KeyEvent.VK_S, 10)));
    pngMenu.add(createPopupMenuItem("Export Viewport Image", null, KeyStroke.getKeyStroke(KeyEvent.VK_S, 2)));
    pngMenu.addSeparator();
    pngMenu.add(createPopupMenuItem("Export Viewport Series", null, KeyStroke.getKeyStroke(KeyEvent.VK_S, 8)));

    JMenu pdfMenu = new JMenu("To PDF");
    pdfMenu.add(createPopupMenuItem("Export Original Image", null,
            KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.SHIFT_DOWN_MASK | KeyEvent.CTRL_DOWN_MASK)));
    pdfMenu.add(createPopupMenuItem("Export Viewport Image", null,
            KeyStroke.getKeyStroke(KeyEvent.VK_P, KeyEvent.ALT_DOWN_MASK | KeyEvent.CTRL_DOWN_MASK)));

    JMenu exportMenu = new JMenu("Export");
    exportMenu.add(pngMenu);
    exportMenu.add(pdfMenu);
    popupMenu.add(exportMenu);
    popupMenu.addSeparator();

    JMenu losslessMenu = new JMenu("Lossless Modifications");
    losslessMenu.add(createPopupMenuItem("Flip Horizontally", null, KeyStroke.getKeyStroke(KeyEvent.VK_H, 10)));
    losslessMenu.add(createPopupMenuItem("Flip Vertically", null, KeyStroke.getKeyStroke(KeyEvent.VK_V, 10)));
    losslessMenu.addSeparator();
    losslessMenu.add(createPopupMenuItem("Rotate +90", null, KeyStroke.getKeyStroke(KeyEvent.VK_R, 10)));
    losslessMenu.add(createPopupMenuItem("Rotate -90", null, KeyStroke.getKeyStroke(KeyEvent.VK_L, 10)));
    popupMenu.add(losslessMenu);
}

From source file:edu.harvard.mcz.imagecapture.encoder.UnitTrayLabelBrowser.java

/**
 * This method initializes jMenuItem1   
 *    /*from  www.j  a  v  a 2s.  co m*/
 * @return javax.swing.JMenuItem   
 */
private JMenuItem getJMenuItem1() {
    if (jMenuItemPaste == null) {
        jMenuItemPaste = new JMenuItem(new DefaultEditorKit.PasteAction());
        jMenuItemPaste.setText("Paste");
        jMenuItemPaste.setMnemonic(KeyEvent.VK_P);
        jMenuItemPaste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK));
        jMenuItemPaste.setEnabled(true);
    }
    return jMenuItemPaste;
}

From source file:com.nbt.TreeFrame.java

private void createActions() {
    newAction = new NBTAction("New", "New", "New", KeyEvent.VK_N) {

        {//from   ww w  . j  av  a  2 s  . c  o m
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('N', Event.CTRL_MASK));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            updateTreeTable(new CompoundTag(""));
        }

    };

    browseAction = new NBTAction("Browse...", "Open", "Browse...", KeyEvent.VK_O) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('O', Event.CTRL_MASK));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = createFileChooser();
            switch (fc.showOpenDialog(TreeFrame.this)) {
            case JFileChooser.APPROVE_OPTION:
                File file = fc.getSelectedFile();
                Preferences prefs = getPreferences();
                prefs.put(KEY_FILE, file.getAbsolutePath());
                doImport(file);
                break;
            }
        }

    };

    saveAction = new NBTAction("Save", "Save", "Save", KeyEvent.VK_S) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('S', Event.CTRL_MASK));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            String path = textFile.getText();
            File file = new File(path);
            if (file.canWrite()) {
                doExport(file);
            } else {
                saveAsAction.actionPerformed(e);
            }
        }

    };

    saveAsAction = new NBTAction("Save As...", "SaveAs", "Save As...", KeyEvent.VK_UNDEFINED) {

        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = createFileChooser();
            switch (fc.showSaveDialog(TreeFrame.this)) {
            case JFileChooser.APPROVE_OPTION:
                File file = fc.getSelectedFile();
                Preferences prefs = getPreferences();
                prefs.put(KEY_FILE, file.getAbsolutePath());
                doExport(file);
                break;
            }
        }

    };

    refreshAction = new NBTAction("Refresh", "Refresh", "Refresh", KeyEvent.VK_F5) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("F5"));
        }

        public void actionPerformed(ActionEvent e) {
            String path = textFile.getText();
            File file = new File(path);
            if (file.canRead())
                doImport(file);
            else
                showErrorDialog("The file could not be read.");
        }

    };

    exitAction = new NBTAction("Exit", "Exit", KeyEvent.VK_ESCAPE) {

        @Override
        public void actionPerformed(ActionEvent e) {
            // TODO: this should check to see if any changes have been made
            // before exiting
            System.exit(0);
        }

    };

    cutAction = new DefaultEditorKit.CutAction() {

        {
            String name = "Cut";
            putValue(NAME, name);
            putValue(SHORT_DESCRIPTION, name);
            putValue(MNEMONIC_KEY, KeyEvent.VK_X);
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('X', Event.CTRL_MASK));

            ImageFactory factory = new ImageFactory();
            try {
                putValue(SMALL_ICON, new ImageIcon(factory.readGeneralImage(name, NBTAction.smallIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }

            try {
                putValue(LARGE_ICON_KEY,
                        new ImageIcon(factory.readGeneralImage(name, NBTAction.largeIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    };

    copyAction = new DefaultEditorKit.CopyAction() {

        {
            String name = "Copy";
            putValue(NAME, name);
            putValue(SHORT_DESCRIPTION, name);
            putValue(MNEMONIC_KEY, KeyEvent.VK_C);
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('C', Event.CTRL_MASK));

            ImageFactory factory = new ImageFactory();
            try {
                putValue(SMALL_ICON, new ImageIcon(factory.readGeneralImage(name, NBTAction.smallIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }

            try {
                putValue(LARGE_ICON_KEY,
                        new ImageIcon(factory.readGeneralImage(name, NBTAction.largeIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    };

    pasteAction = new DefaultEditorKit.CutAction() {

        {
            String name = "Paste";
            putValue(NAME, name);
            putValue(SHORT_DESCRIPTION, name);
            putValue(MNEMONIC_KEY, KeyEvent.VK_V);
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('V', Event.CTRL_MASK));

            ImageFactory factory = new ImageFactory();
            try {
                putValue(SMALL_ICON, new ImageIcon(factory.readGeneralImage(name, NBTAction.smallIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }

            try {
                putValue(LARGE_ICON_KEY,
                        new ImageIcon(factory.readGeneralImage(name, NBTAction.largeIconSize)));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    };

    deleteAction = new NBTAction("Delete", "Delete", "Delete", KeyEvent.VK_DELETE) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("DELETE"));
        }

        public void actionPerformed(ActionEvent e) {
            int row = treeTable.getSelectedRow();
            TreePath path = treeTable.getPathForRow(row);
            Object last = path.getLastPathComponent();

            if (last instanceof NBTFileBranch) {
                NBTFileBranch branch = (NBTFileBranch) last;
                File file = branch.getFile();
                String name = file.getName();
                String message = "Are you sure you want to delete " + name + "?";
                String title = "Continue?";
                int option = JOptionPane.showConfirmDialog(TreeFrame.this, message, title,
                        JOptionPane.OK_CANCEL_OPTION);
                switch (option) {
                case JOptionPane.CANCEL_OPTION:
                    return;
                }
                if (!FileUtils.deleteQuietly(file)) {
                    showErrorDialog(name + " could not be deleted.");
                    return;
                }
            }

            TreePath parentPath = path.getParentPath();
            Object parentLast = parentPath.getLastPathComponent();
            NBTTreeTableModel model = treeTable.getTreeTableModel();
            int index = model.getIndexOfChild(parentLast, last);
            if (parentLast instanceof Mutable<?>) {
                Mutable<?> mutable = (Mutable<?>) parentLast;
                if (last instanceof ByteWrapper) {
                    ByteWrapper wrapper = (ByteWrapper) last;
                    index = wrapper.getIndex();
                }
                mutable.remove(index);
            } else {
                System.err.println(last.getClass());
                return;
            }

            updateTreeTable();
            treeTable.expandPath(parentPath);
            scrollTo(parentLast);
            treeTable.setRowSelectionInterval(row, row);
        }

    };

    openAction = new NBTAction("Open...", "Open...", KeyEvent.VK_T) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('T', Event.CTRL_MASK));

            final int diamondPickaxe = 278;
            SpriteRecord record = NBTTreeTable.register.getRecord(diamondPickaxe);
            BufferedImage image = record.getImage();
            setSmallIcon(image);

            int width = 24, height = 24;
            Dimension size = new Dimension(width, height);
            Map<RenderingHints.Key, ?> hints = Thumbnail.createRenderingHints(Thumbnail.QUALITY);
            BufferedImage largeImage = Thumbnail.createThumbnail(image, size, hints);
            setLargeIcon(largeImage);
        }

        public void actionPerformed(ActionEvent e) {
            TreePath path = treeTable.getPath();
            if (path == null)
                return;

            Object last = path.getLastPathComponent();
            if (last instanceof Region) {
                Region region = (Region) last;
                createAndShowTileCanvas(new TileCanvas.TileWorld(region));
                return;
            } else if (last instanceof World) {
                World world = (World) last;
                createAndShowTileCanvas(world);
                return;
            }

            if (last instanceof NBTFileBranch) {
                NBTFileBranch fileBranch = (NBTFileBranch) last;
                File file = fileBranch.getFile();
                try {
                    open(file);
                } catch (IOException ex) {
                    ex.printStackTrace();
                    showErrorDialog(ex.getMessage());
                }
            }
        }

        private void open(File file) throws IOException {
            if (Desktop.isDesktopSupported()) {
                Desktop desktop = Desktop.getDesktop();
                if (desktop.isSupported(Desktop.Action.OPEN)) {
                    desktop.open(file);
                }
            }
        }

    };

    addByteAction = new NBTAction("Add Byte", NBTConstants.TYPE_BYTE, "Add Byte", KeyEvent.VK_1) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('1', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new ByteTag("new byte", (byte) 0));
        }

    };

    addShortAction = new NBTAction("Add Short", NBTConstants.TYPE_SHORT, "Add Short", KeyEvent.VK_2) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('2', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new ShortTag("new short", (short) 0));
        }

    };

    addIntAction = new NBTAction("Add Integer", NBTConstants.TYPE_INT, "Add Integer", KeyEvent.VK_3) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('3', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new IntTag("new int", 0));
        }

    };

    addLongAction = new NBTAction("Add Long", NBTConstants.TYPE_LONG, "Add Long", KeyEvent.VK_4) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('4', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new LongTag("new long", 0));
        }

    };

    addFloatAction = new NBTAction("Add Float", NBTConstants.TYPE_FLOAT, "Add Float", KeyEvent.VK_5) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('5', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new FloatTag("new float", 0));
        }

    };

    addDoubleAction = new NBTAction("Add Double", NBTConstants.TYPE_DOUBLE, "Add Double", KeyEvent.VK_6) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('6', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new DoubleTag("new double", 0));
        }

    };

    addByteArrayAction = new NBTAction("Add Byte Array", NBTConstants.TYPE_BYTE_ARRAY, "Add Byte Array",
            KeyEvent.VK_7) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('7', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new ByteArrayTag("new byte array"));
        }

    };

    addStringAction = new NBTAction("Add String", NBTConstants.TYPE_STRING, "Add String", KeyEvent.VK_8) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('8', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new StringTag("new string", "..."));
        }

    };

    addListAction = new NBTAction("Add List Tag", NBTConstants.TYPE_LIST, "Add List Tag", KeyEvent.VK_9) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('9', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            Class<? extends Tag> type = queryType();
            if (type != null)
                addTag(new ListTag("new list", null, type));
        }

        private Class<? extends Tag> queryType() {
            Object[] items = { NBTConstants.TYPE_BYTE, NBTConstants.TYPE_SHORT, NBTConstants.TYPE_INT,
                    NBTConstants.TYPE_LONG, NBTConstants.TYPE_FLOAT, NBTConstants.TYPE_DOUBLE,
                    NBTConstants.TYPE_BYTE_ARRAY, NBTConstants.TYPE_STRING, NBTConstants.TYPE_LIST,
                    NBTConstants.TYPE_COMPOUND };
            JComboBox comboBox = new JComboBox(new DefaultComboBoxModel(items));
            comboBox.setRenderer(new DefaultListCellRenderer() {

                @Override
                public Component getListCellRendererComponent(JList list, Object value, int index,
                        boolean isSelected, boolean cellHasFocus) {
                    super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

                    if (value instanceof Integer) {
                        Integer i = (Integer) value;
                        Class<? extends Tag> c = NBTUtils.getTypeClass(i);
                        String name = NBTUtils.getTypeName(c);
                        setText(name);
                    }

                    return this;
                }

            });
            Object[] message = { new JLabel("Please select a type."), comboBox };
            String title = "Title goes here";
            int result = JOptionPane.showOptionDialog(TreeFrame.this, message, title,
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
            switch (result) {
            case JOptionPane.OK_OPTION:
                ComboBoxModel model = comboBox.getModel();
                Object item = model.getSelectedItem();
                if (item instanceof Integer) {
                    Integer i = (Integer) item;
                    return NBTUtils.getTypeClass(i);
                }
            }
            return null;
        }

    };

    addCompoundAction = new NBTAction("Add Compound Tag", NBTConstants.TYPE_COMPOUND, "Add Compound Tag",
            KeyEvent.VK_0) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke('0', Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            addTag(new CompoundTag());
        }

    };

    String name = "About " + TITLE;
    helpAction = new NBTAction(name, "Help", name, KeyEvent.VK_F1) {

        {
            putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke("F1"));
        }

        public void actionPerformed(ActionEvent e) {
            Object[] message = { new JLabel(TITLE + " " + VERSION),
                    new JLabel("\u00A9 Copyright Taggart Spilman 2011.  All rights reserved."),
                    new Hyperlink("<html><a href=\"#\">NamedBinaryTag.com</a></html>",
                            "http://www.namedbinarytag.com"),
                    new Hyperlink("<html><a href=\"#\">Contact</a></html>", "mailto:tagadvance@gmail.com"),
                    new JLabel(" "),
                    new Hyperlink("<html><a href=\"#\">JNBT was written by Graham Edgecombe</a></html>",
                            "http://jnbt.sf.net"),
                    new Hyperlink("<html><a href=\"#\">Available open-source under the BSD license</a></html>",
                            "http://jnbt.sourceforge.net/LICENSE.TXT"),
                    new JLabel(" "), new JLabel("This product includes software developed by"),
                    new Hyperlink("<html><a href=\"#\">The Apache Software Foundation</a>.</html>",
                            "http://www.apache.org"),
                    new JLabel(" "), new JLabel("Default texture pack:"),
                    new Hyperlink("<html><a href=\"#\">SOLID COLOUR. SOLID STYLE.</a></html>",
                            "http://www.minecraftforum.net/topic/72253-solid-colour-solid-style/"),
                    new JLabel("Bundled with the permission of Trigger_Proximity."),

            };
            String title = "About";
            JOptionPane.showMessageDialog(TreeFrame.this, message, title, JOptionPane.INFORMATION_MESSAGE);
        }

    };

}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.AnnotationReportApplet.java

private JMenu createViewMenu() {
    GraphicOptions view_opt = theCanvas.getWorkspace().getGraphicOptions();

    JMenu view_menu = new JMenu("View");
    view_menu.setMnemonic(KeyEvent.VK_V);

    // zoom //  w w  w  . jav  a  2s .  com
    view_menu.add(theActionManager.get("zoomnone"));
    view_menu.add(theActionManager.get("zoomin"));
    view_menu.add(theActionManager.get("zoomout"));

    view_menu.addSeparator();

    // notation 
    JRadioButtonMenuItem last = null;
    ButtonGroup groupn = new ButtonGroup();

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("notation=" + GraphicOptions.NOTATION_CFG)));
    last.setSelected(view_opt.NOTATION.equals(GraphicOptions.NOTATION_CFG));
    groupn.add(last);

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("notation=" + GraphicOptions.NOTATION_CFGBW)));
    last.setSelected(view_opt.NOTATION.equals(GraphicOptions.NOTATION_CFGBW));
    groupn.add(last);

    view_menu.add(last = new JRadioButtonMenuItem(
            theActionManager.get("notation=" + GraphicOptions.NOTATION_CFGLINK)));
    last.setSelected(view_opt.NOTATION.equals(GraphicOptions.NOTATION_CFGLINK));
    groupn.add(last);

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("notation=" + GraphicOptions.NOTATION_UOXF)));
    last.setSelected(view_opt.NOTATION.equals(GraphicOptions.NOTATION_UOXF));
    groupn.add(last);

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("notation=" + GraphicOptions.NOTATION_TEXT)));
    last.setSelected(view_opt.NOTATION.equals(GraphicOptions.NOTATION_TEXT));
    groupn.add(last);

    view_menu.addSeparator();

    // display 

    display_button_group = new ButtonGroup();
    display_models = new HashMap<String, ButtonModel>();

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("display=" + GraphicOptions.DISPLAY_COMPACT)));
    last.setSelected(view_opt.DISPLAY.equals(GraphicOptions.DISPLAY_COMPACT));
    display_models.put(GraphicOptions.DISPLAY_COMPACT, last.getModel());
    display_button_group.add(last);

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("display=" + GraphicOptions.DISPLAY_NORMAL)));
    last.setSelected(view_opt.DISPLAY.equals(GraphicOptions.DISPLAY_NORMAL));
    display_models.put(GraphicOptions.DISPLAY_NORMAL, last.getModel());
    display_button_group.add(last);

    view_menu.add(last = new JRadioButtonMenuItem(
            theActionManager.get("display=" + GraphicOptions.DISPLAY_NORMALINFO)));
    last.setSelected(view_opt.DISPLAY.equals(GraphicOptions.DISPLAY_NORMALINFO));
    display_models.put(GraphicOptions.DISPLAY_NORMALINFO, last.getModel());
    display_button_group.add(last);

    view_menu.add(
            last = new JRadioButtonMenuItem(theActionManager.get("display=" + GraphicOptions.DISPLAY_CUSTOM)));
    last.setSelected(view_opt.DISPLAY.equals(GraphicOptions.DISPLAY_CUSTOM));
    display_models.put(GraphicOptions.DISPLAY_CUSTOM, last.getModel());
    display_button_group.add(last);

    //view_menu.add( lastcb = new JCheckBoxMenuItem(theActionManager.get("showinfo")) );
    //lastcb.setState(view_opt.SHOW_INFO);

    view_menu.addSeparator();

    // orientation

    view_menu.add(theActionManager.get("orientation"));

    view_menu.addSeparator();

    view_menu.add(theActionManager.get("displaysettings"));
    view_menu.add(theActionManager.get("reportsettings"));

    return view_menu;
}

From source file:de.tor.tribes.ui.windows.TribeTribeAttackFrame.java

/**
 * Creates new form TribeTribeAttackFrame
 *///from  w ww.  ja  v a  2 s.  c  om
public TribeTribeAttackFrame() {
    initComponents();
    centerPanel = new GenericTestPanel();
    jMainPanel.add(centerPanel, BorderLayout.CENTER);
    centerPanel.setChildComponent(jxAttackPlanerPanel);
    buildMenu();
    capabilityInfoPanel1.addActionListener(this, jSourcesTable);
    capabilityInfoPanel2.addActionListener(this, jResultsTable);

    KeyStroke copy = KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK, false);
    KeyStroke bbCopy = KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK, false);
    KeyStroke paste = KeyStroke.getKeyStroke(KeyEvent.VK_V, ActionEvent.CTRL_MASK, false);
    KeyStroke cut = KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK, false);
    KeyStroke delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false);
    jSourcesTable.registerKeyboardAction(TribeTribeAttackFrame.this, "Copy", copy,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    jVictimTable.registerKeyboardAction(TribeTribeAttackFrame.this, "Copy", copy,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    jResultsTable.registerKeyboardAction(TribeTribeAttackFrame.this, "Copy", copy,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    jSourcesTable.registerKeyboardAction(TribeTribeAttackFrame.this, "Paste", paste,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    jVictimTable.registerKeyboardAction(TribeTribeAttackFrame.this, "Paste", paste,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    jSourcesTable.registerKeyboardAction(TribeTribeAttackFrame.this, "Cut", cut,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    jVictimTable.registerKeyboardAction(TribeTribeAttackFrame.this, "Cut", cut,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    jSourcesTable.registerKeyboardAction(TribeTribeAttackFrame.this, "Delete", delete,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    jVictimTable.registerKeyboardAction(TribeTribeAttackFrame.this, "Delete", delete,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    jResultsTable.registerKeyboardAction(TribeTribeAttackFrame.this, "Delete", delete,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    jResultsTable.registerKeyboardAction(TribeTribeAttackFrame.this, "BBCopy", bbCopy,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    Action noFind = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            //no find
        }
    };
    jSourcesTable.getActionMap().put("find", noFind);
    jVictimTable.getActionMap().put("find", noFind);
    jResultsTable.getActionMap().put("find", noFind);

    jSourcesTable.getSelectionModel().addListSelectionListener(TribeTribeAttackFrame.this);
    jVictimTable.getSelectionModel().addListSelectionListener(TribeTribeAttackFrame.this);
    jResultsTable.getSelectionModel().addListSelectionListener(TribeTribeAttackFrame.this);

    jideTabbedPane1.setTabShape(JideTabbedPane.SHAPE_OFFICE2003);
    jideTabbedPane1.setTabColorProvider(JideTabbedPane.ONENOTE_COLOR_PROVIDER);
    jideTabbedPane1.setBoldActiveTab(true);
    TagManager.getSingleton().addManagerListener(TribeTribeAttackFrame.this);
    logPanel = new AlgorithmLogPanel();
    mLogFrame = new JFrame("Informationen zur Berechnung");
    mLogFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    mLogFrame.setLayout(new BorderLayout());
    mLogFrame.add(logPanel);
    mLogFrame.pack();
    mTroopSplitDialog = new TroopSplitDialog(TribeTribeAttackFrame.this, true);
    mSettingsPanel = new SettingsPanel(this);
    jSettingsContentPanel.add(mSettingsPanel, BorderLayout.CENTER);
    jAttackResultDetailsFrame.pack();
    jTargetResultDetailsFrame.pack();
    dragSource = DragSource.getDefaultDragSource();
    dragSource.createDefaultDragGestureRecognizer(TribeTribeAttackFrame.this, DnDConstants.ACTION_COPY_OR_MOVE,
            TribeTribeAttackFrame.this);
    new DropTarget(jSourcesTable, TribeTribeAttackFrame.this);
    new DropTarget(jVictimTable, TribeTribeAttackFrame.this);
    for (MouseListener l : jAllTargetsComboBox.getMouseListeners()) {
        jAllTargetsComboBox.removeMouseListener(l);
    }
    jAllTargetsComboBox.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            fireAddFilteredTargetVillages();
        }
    });

    filterDialog = new TroopFilterDialog(this, true);

    // <editor-fold defaultstate="collapsed" desc="Add selection listeners">
    jVillageGroupList.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                fireFilterSourceVillagesByGroupEvent();
            }
        }
    });
    jSourceContinentList.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                fireFilterSourceContinentEvent();
            }
        }
    });
    jTargetTribeList.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                fireFilterTargetByTribeEvent();
            }
        }
    });
    jTargetContinentList.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                fireFilterTargetByContinentEvent();
            }
        }
    });

    jTargetAllyList.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                fireFilterTargetByAllyEvent();
            }
        }
    });
    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem ">
    if (!Constants.DEBUG) {
        GlobalOptions.getHelpBroker().enableHelp(jSourcePanel, "pages.attack_planer_source",
                GlobalOptions.getHelpBroker().getHelpSet());
        GlobalOptions.getHelpBroker().enableHelp(jTargetPanel, "pages.attack_planer_target",
                GlobalOptions.getHelpBroker().getHelpSet());
        GlobalOptions.getHelpBroker().enableHelp(mSettingsPanel, "pages.attack_planer_settings",
                GlobalOptions.getHelpBroker().getHelpSet());
        GlobalOptions.getHelpBroker().enableHelpKey(jResultFrame.getRootPane(), "pages.attack_planer_results",
                GlobalOptions.getHelpBroker().getHelpSet());
        GlobalOptions.getHelpBroker().enableHelpKey(jTargetResultDetailsFrame.getRootPane(),
                "pages.attack_planer_results_details_targets", GlobalOptions.getHelpBroker().getHelpSet());
        GlobalOptions.getHelpBroker().enableHelpKey(jAttackResultDetailsFrame.getRootPane(),
                "pages.attack_planer_results_details_sources", GlobalOptions.getHelpBroker().getHelpSet());
        GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.attack_planer",
                GlobalOptions.getHelpBroker().getHelpSet());
    }
    // </editor-fold>
}

From source file:edu.ku.brc.ui.tmanfe.SpreadSheet.java

/**
  * //  w  ww  .  ja v  a  2s.  c o m
  */
protected void buildSpreadsheet() {

    this.setShowGrid(true);

    int numRows = model.getRowCount();

    scrollPane = new JScrollPane(this, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

    final SpreadSheet ss = this;
    JButton cornerBtn = UIHelper.createIconBtn("Blank", IconManager.IconSize.Std16, "SelectAll",
            new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    ss.selectAll();
                }
            });
    cornerBtn.setEnabled(true);
    scrollPane.setCorner(ScrollPaneConstants.UPPER_LEFT_CORNER, cornerBtn);

    // Allows row and collumn selections to exit at the same time
    setCellSelectionEnabled(true);

    setRowSelectionAllowed(true);
    setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    addMouseListener(new MouseAdapter() {
        /* (non-Javadoc)
         * @see java.awt.event.MouseAdapter#mousePressed(java.awt.event.MouseEvent)
         */
        @SuppressWarnings("synthetic-access")
        @Override
        public void mouseReleased(MouseEvent e) {
            // XXX For Java 5 Bug
            prevRowSelInx = getSelectedRow();
            prevColSelInx = getSelectedColumn();

            if (e.getClickCount() == 2) {
                int rowIndexStart = getSelectedRow();
                int colIndexStart = getSelectedColumn();

                ss.editCellAt(rowIndexStart, colIndexStart);
                if (ss.getEditorComponent() != null && ss.getEditorComponent() instanceof JTextComponent) {
                    ss.getEditorComponent().requestFocus();

                    final JTextComponent txtComp = (JTextComponent) ss.getEditorComponent();
                    String txt = txtComp.getText();
                    FontMetrics fm = txtComp.getFontMetrics(txtComp.getFont());
                    int x = e.getPoint().x - ss.getEditorComponent().getBounds().x - 1;
                    int prevWidth = 0;
                    for (int i = 0; i < txt.length(); i++) {

                        int width = fm.stringWidth(txt.substring(0, i));
                        int basePlusHalf = prevWidth + (int) (((width - prevWidth) / 2) + 0.5);
                        //System.out.println(prevWidth + " X[" + x + "] " + width+" ["+txt.substring(0, i)+"] " + i + " " + basePlusHalf);
                        //System.out.println(" X[" + x + "] " + prevWidth + " - "+ basePlusHalf+" - " + width+" ["+txt.substring(0, i)+"] " + i);
                        if (x < width) {
                            // Clearing the selection is needed for Window for some reason
                            final int inx = i + (x <= basePlusHalf ? -1 : 0);
                            SwingUtilities.invokeLater(new Runnable() {
                                @SuppressWarnings("synthetic-access")
                                public void run() {
                                    txtComp.setSelectionStart(0);
                                    txtComp.setSelectionEnd(0);
                                    txtComp.setCaretPosition(inx > 0 ? inx : 0);
                                }
                            });
                            break;
                        }
                        prevWidth = width;
                    }
                }
            }
        }
    });

    // Create a row-header to display row numbers.
    // This row-header is made of labels whose Borders,
    // Foregrounds, Backgrounds, and Fonts must be
    // the one used for the table column headers.
    // Also ensure that the row-header labels and the table
    // rows have the same height.

    //i have no idea WHY this has to be called.  i rearranged
    //the table and find replace panel, 
    // i started getting an array index out of
    //bounds on the column header ON MAC ONLY.  
    //tried firing this off, first and it fixed the problem.//meg
    this.getModel().fireTableStructureChanged();

    /*
     * Create the Row Header Panel
     */
    rowHeaderPanel = new JPanel((LayoutManager) null);

    if (getColumnModel().getColumnCount() > 0) {
        TableColumn column = getColumnModel().getColumn(0);
        TableCellRenderer renderer = getTableHeader().getDefaultRenderer();
        if (renderer == null) {
            renderer = column.getHeaderRenderer();
        }

        Component cellRenderComp = renderer.getTableCellRendererComponent(this, column.getHeaderValue(), false,
                false, -1, 0);
        cellFont = cellRenderComp.getFont();

    } else {
        cellFont = (new JLabel()).getFont();
    }

    // Calculate Row Height
    cellBorder = (Border) UIManager.getDefaults().get("TableHeader.cellBorder");
    Insets insets = cellBorder.getBorderInsets(tableHeader);
    FontMetrics metrics = getFontMetrics(cellFont);

    rowHeight = insets.bottom + metrics.getHeight() + insets.top;
    rowLabelWidth = metrics.stringWidth("9999") + insets.right + insets.left;

    Dimension dim = new Dimension(rowLabelWidth, rowHeight * numRows);
    rowHeaderPanel.setPreferredSize(dim); // need to call this when no layout manager is used.

    rhCellMouseAdapter = new RHCellMouseAdapter(this);

    // Adding the row header labels
    for (int ii = 0; ii < numRows; ii++) {
        addRow(ii, ii + 1, false);
    }

    JViewport viewPort = new JViewport();
    dim.height = rowHeight * numRows;
    viewPort.setViewSize(dim);
    viewPort.setView(rowHeaderPanel);
    scrollPane.setRowHeader(viewPort);

    // Experimental from the web, but I think it does the trick.
    addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (!ss.isEditing() && !e.isActionKey() && !e.isControlDown() && !e.isMetaDown() && !e.isAltDown()
                    && e.getKeyCode() != KeyEvent.VK_SHIFT && e.getKeyCode() != KeyEvent.VK_TAB
                    && e.getKeyCode() != KeyEvent.VK_ENTER) {
                log.error("Grabbed the event as input");

                int rowIndexStart = getSelectedRow();
                int colIndexStart = getSelectedColumn();

                if (rowIndexStart == -1 || colIndexStart == -1)
                    return;

                ss.editCellAt(rowIndexStart, colIndexStart);
                Component c = ss.getEditorComponent();
                if (c instanceof JTextComponent)
                    ((JTextComponent) c).setText("");
            }
        }
    });

    resizeAndRepaint();

    // Taken from a JavaWorld Example (But it works)
    KeyStroke cut = KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(),
            false);
    KeyStroke copy = KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(),
            false);
    KeyStroke paste = KeyStroke.getKeyStroke(KeyEvent.VK_V,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);

    Action ssAction = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            SpreadSheet.this.actionPerformed(e);
        }
    };

    getInputMap().put(cut, "Cut");
    getActionMap().put("Cut", ssAction);

    getInputMap().put(copy, "Copy");
    getActionMap().put("Copy", ssAction);

    getInputMap().put(paste, "Paste");
    getActionMap().put("Paste", ssAction);

    ((JMenuItem) UIRegistry.get(UIRegistry.COPY)).addActionListener(this);
    ((JMenuItem) UIRegistry.get(UIRegistry.CUT)).addActionListener(this);
    ((JMenuItem) UIRegistry.get(UIRegistry.PASTE)).addActionListener(this);

    setSortOrderCycle(SortOrder.ASCENDING, SortOrder.DESCENDING, SortOrder.UNSORTED);
}

From source file:com.digitalgeneralists.assurance.ui.MainWindow.java

private void initializeComponent() {
    if (!this.initialized) {
        logger.info("Initializing the main window.");

        if (AssuranceUtils.getPlatform() == Platform.MAC) {

            System.setProperty("apple.laf.useScreenMenuBar", "true");
            com.apple.eawt.Application macApplication = com.apple.eawt.Application.getApplication();
            MacApplicationAdapter macAdapter = new MacApplicationAdapter(this);
            macApplication.addApplicationListener(macAdapter);
            macApplication.setEnabledPreferencesMenu(true);
        }//from  ww  w .  j a v  a 2s.co m

        this.setTitle(Application.applicationShortName);

        this.setDefaultCloseOperation(EXIT_ON_CLOSE);

        GridBagLayout gridbag = new GridBagLayout();
        this.setLayout(gridbag);

        this.topArea = new JTabbedPane();

        this.scanLaunchPanel.setPreferredSize(new Dimension(600, 150));

        this.scanHistoryPanel.setPreferredSize(new Dimension(600, 150));

        this.topArea.addTab("Scan", this.scanLaunchPanel);

        this.topArea.addTab("History", this.scanHistoryPanel);

        this.resultsPanel.setPreferredSize(new Dimension(600, 400));

        this.topArea.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                resultsPanel.resetPanel();
                // NOTE:  This isn't ideal.  It feels brittle.
                if (topArea.getSelectedIndex() == viewHistoryMenuItemIndex) {
                    viewHistoryMenuItem.setSelected(true);
                } else {
                    viewScanMenuItem.setSelected(true);
                }
            }
        });

        GridBagConstraints topPanelConstraints = new GridBagConstraints();
        topPanelConstraints.anchor = GridBagConstraints.NORTH;
        topPanelConstraints.fill = GridBagConstraints.BOTH;
        topPanelConstraints.gridx = 0;
        topPanelConstraints.gridy = 0;
        topPanelConstraints.weightx = 1.0;
        topPanelConstraints.weighty = 0.33;
        topPanelConstraints.gridheight = 1;
        topPanelConstraints.gridwidth = 1;
        topPanelConstraints.insets = new Insets(0, 0, 0, 0);

        this.getContentPane().add(this.topArea, topPanelConstraints);

        GridBagConstraints resultsPanelConstraints = new GridBagConstraints();
        resultsPanelConstraints.anchor = GridBagConstraints.SOUTH;
        resultsPanelConstraints.fill = GridBagConstraints.BOTH;
        resultsPanelConstraints.gridx = 0;
        resultsPanelConstraints.gridy = 1;
        resultsPanelConstraints.weightx = 1.0;
        resultsPanelConstraints.weighty = 0.67;
        resultsPanelConstraints.gridheight = 1;
        resultsPanelConstraints.gridwidth = 1;
        resultsPanelConstraints.insets = new Insets(0, 0, 0, 0);

        this.getContentPane().add(this.resultsPanel, resultsPanelConstraints);

        this.applicationDelegate.addEventObserver(ScanStartedEvent.class, this);
        this.applicationDelegate.addEventObserver(ScanCompletedEvent.class, this);
        this.applicationDelegate.addEventObserver(SetScanDefinitionMenuStateEvent.class, this);
        this.applicationDelegate.addEventObserver(SetScanResultsMenuStateEvent.class, this);
        this.applicationDelegate.addEventObserver(ApplicationConfigurationLoadedEvent.class, this);

        JMenu menu;
        JMenuItem menuItem;

        menuBar = new JMenuBar();

        StringBuilder accessiblityLabel = new StringBuilder(128);
        if (AssuranceUtils.getPlatform() != Platform.MAC) {
            menu = new JMenu(Application.applicationShortName);
            menu.getAccessibleContext().setAccessibleDescription(accessiblityLabel.append("Actions for ")
                    .append(Application.applicationShortName).append(" application").toString());
            accessiblityLabel.setLength(0);
            menuBar.add(menu);

            menuItem = new JMenuItem(MainWindow.quitApplicationMenuLabel, KeyEvent.VK_Q);
            menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
            menuItem.getAccessibleContext().setAccessibleDescription(accessiblityLabel.append("Close the ")
                    .append(Application.applicationShortName).append(" application").toString());
            accessiblityLabel.setLength(0);
            menuItem.addActionListener(this);
            menuItem.setActionCommand(AssuranceActions.quitApplicationAction);
            menu.add(menuItem);

            menu.addSeparator();

            menuItem = new JMenuItem(MainWindow.aboutApplicationMenuLabel);
            menuItem.getAccessibleContext().setAccessibleDescription(
                    accessiblityLabel.append("Display information about this version of ")
                            .append(Application.applicationShortName).append(".").toString());
            accessiblityLabel.setLength(0);
            menuItem.addActionListener(this);
            menuItem.setActionCommand(AssuranceActions.aboutApplicationAction);
            menu.add(menuItem);
        }

        menu = new JMenu("Scan");
        menu.setMnemonic(KeyEvent.VK_S);
        menu.getAccessibleContext().setAccessibleDescription("Actions for file scans");
        menuBar.add(menu);

        menuItem = new JMenuItem(MainWindow.newScanDefinitonMenuLabel, KeyEvent.VK_N);
        menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
        menuItem.getAccessibleContext().setAccessibleDescription("Create a new scan definition");
        menuItem.addActionListener(this.scanLaunchPanel);
        menuItem.setActionCommand(AssuranceActions.newScanDefinitonAction);
        menu.add(menuItem);

        menuItem = new JMenuItem(MainWindow.deleteScanDefinitonMenuLabel, KeyEvent.VK_D);
        menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, ActionEvent.CTRL_MASK));
        menuItem.getAccessibleContext().setAccessibleDescription("Delete the selected scan definition");
        menuItem.addActionListener(this.scanLaunchPanel);
        menuItem.setActionCommand(AssuranceActions.deleteScanDefinitonAction);
        menu.add(menuItem);

        menu.addSeparator();

        menuItem = new JMenuItem(MainWindow.scanMenuLabel, KeyEvent.VK_S);
        menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
        menuItem.getAccessibleContext()
                .setAccessibleDescription("Launch a scan using the selected scan definition");
        menuItem.addActionListener(this.scanLaunchPanel);
        menuItem.setActionCommand(AssuranceActions.scanAction);
        menu.add(menuItem);

        menuItem = new JMenuItem(MainWindow.scanAndMergeMenuLabel, KeyEvent.VK_M);
        menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK));
        menuItem.getAccessibleContext().setAccessibleDescription(
                "Launch a scan using the selected scan definition and merge the results");
        menuItem.addActionListener(this.scanLaunchPanel);
        menuItem.setActionCommand(AssuranceActions.scanAndMergeAction);
        menu.add(menuItem);

        menu = new JMenu("Results");
        menu.setMnemonic(KeyEvent.VK_R);
        menu.getAccessibleContext().setAccessibleDescription("Actions for scan results");
        menuBar.add(menu);

        menuItem = new JMenuItem(MainWindow.replaceSourceMenuLabel, KeyEvent.VK_O);
        menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
        menuItem.getAccessibleContext()
                .setAccessibleDescription("Replace the source file with the target file");
        menuItem.addActionListener(this.resultsPanel.getResultMenuListener());
        menuItem.setActionCommand(AssuranceActions.replaceSourceAction);
        menu.add(menuItem);

        menuItem = new JMenuItem(MainWindow.replaceTargetMenuLabel, KeyEvent.VK_T);
        menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.CTRL_MASK));
        menuItem.getAccessibleContext()
                .setAccessibleDescription("Replace the target file with the source file");
        menuItem.addActionListener(this.resultsPanel.getResultMenuListener());
        menuItem.setActionCommand(AssuranceActions.replaceTargetAction);
        menu.add(menuItem);

        menu.addSeparator();

        menuItem = new JMenuItem(MainWindow.sourceAttributesMenuLabel);
        menuItem.getAccessibleContext().setAccessibleDescription("View the source file attributes");
        menuItem.addActionListener(this.resultsPanel.getResultMenuListener());
        menuItem.setActionCommand(AssuranceActions.sourceAttributesAction);
        menu.add(menuItem);

        menuItem = new JMenuItem(MainWindow.targetAttributesMenuLabel);
        menuItem.getAccessibleContext().setAccessibleDescription("View the target file attributes");
        menuItem.addActionListener(this.resultsPanel.getResultMenuListener());
        menuItem.setActionCommand(AssuranceActions.targetAttributesAction);
        menu.add(menuItem);

        menu = new JMenu("View");
        menu.setMnemonic(KeyEvent.VK_V);
        menu.getAccessibleContext().setAccessibleDescription(
                accessiblityLabel.append("Views within ").append(Application.applicationShortName).toString());
        accessiblityLabel.setLength(0);
        menuBar.add(menu);

        ButtonGroup group = new ButtonGroup();

        this.viewScanMenuItem = new JRadioButtonMenuItem(MainWindow.viewScanMenuLabel);
        this.viewScanMenuItem.addActionListener(this);
        this.viewScanMenuItem.setActionCommand(AssuranceActions.viewScanAction);
        this.viewScanMenuItem.setSelected(true);
        group.add(this.viewScanMenuItem);
        menu.add(this.viewScanMenuItem);

        this.viewHistoryMenuItem = new JRadioButtonMenuItem(MainWindow.viewHistoryMenuLabel);
        this.viewHistoryMenuItem.addActionListener(this);
        this.viewHistoryMenuItem.setActionCommand(AssuranceActions.viewHistoryAction);
        this.viewHistoryMenuItem.setSelected(true);
        group.add(this.viewHistoryMenuItem);
        menu.add(this.viewHistoryMenuItem);

        if (AssuranceUtils.getPlatform() != Platform.MAC) {
            menu = new JMenu("Tools");
            menu.getAccessibleContext()
                    .setAccessibleDescription(accessiblityLabel.append("Additional actions for ")
                            .append(Application.applicationShortName).append(" application").toString());
            accessiblityLabel.setLength(0);
            menuBar.add(menu);

            menuItem = new JMenuItem(MainWindow.settingsMenuLabel, KeyEvent.VK_COMMA);
            menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, ActionEvent.CTRL_MASK));
            menuItem.getAccessibleContext()
                    .setAccessibleDescription(accessiblityLabel.append("Change settings for the ")
                            .append(Application.applicationShortName).append(" application").toString());
            accessiblityLabel.setLength(0);
            menuItem.addActionListener(this);
            menuItem.setActionCommand(AssuranceActions.displaySettingsAction);
            menu.add(menuItem);
        }

        this.setJMenuBar(menuBar);

        this.initialized = true;
    }
}

From source file:com.qspin.qtaste.ui.xmleditor.TestRequirementEditor.java

private void genUI() {
    getActionMap().put("Save", new SaveAction());
    getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
            .put(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK), "Save");
    m_TestRequirementTable = new JTable() {

        @Override//from   ww  w.j a v a  2s . c o m
        public String getToolTipText(MouseEvent e) {
            Point p = e.getPoint();
            int rowIndex = rowAtPoint(p);
            int colIndex = columnAtPoint(p);
            if (colIndex < 0) {
                return null;
            }
            return convertObjectToToolTip(getValueAt(rowIndex, colIndex));
        }

        // overwrite cell content when typing on a selected cell
        @Override
        public Component prepareEditor(TableCellEditor editor, int row, int column) {
            Component c = super.prepareEditor(editor, row, column);

            if (c instanceof JTextComponent) {
                ((JTextField) c).selectAll();
            }

            return c;
        }

        // select entire rows when selecting first column (row id)
        @Override
        public void columnSelectionChanged(ListSelectionEvent e) {
            if (e.getFirstIndex() == 0 && e.getValueIsAdjusting()) {
                setColumnSelectionInterval(1, getColumnCount() - 1);
            } else {
                super.columnSelectionChanged(e);
            }
        }
    };
    m_TestRequirementTable.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);

    m_TestRequirementModel = new TestRequirementTableModel();

    m_TestRequirementTable.setModel(m_TestRequirementModel);

    m_TableColumnModelListener = new MyTableColumnModelListener();
    m_TestRequirementTable.setSurrendersFocusOnKeystroke(true);
    m_TestRequirementTable.setColumnSelectionAllowed(true);
    m_TestRequirementTable.addMouseListener(new TableMouseListener(m_TestRequirementTable));
    m_TestRequirementTable.getTableHeader().addMouseListener(new TableMouseListener(m_TestRequirementTable));
    m_TestRequirementTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    m_TestRequirementTable.getActionMap().put("Save", new SaveAction());
    m_TestRequirementTable.setDefaultEditor(String.class, new TestDataTableCellEditor());
    m_TestRequirementTable.setDefaultEditor(Integer.class, new TestDataTableCellEditor());
    m_TestRequirementTable.getTableHeader().getInputMap()
            .put(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK), "Save");
    m_TestRequirementTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK),
            "Save");
    m_TestRequirementTable.setRowHeight(ROW_HEIGHT);

    m_TestRequirementTable.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            //
            if (e.getKeyCode() == KeyEvent.VK_UP) {
                // check if previous line is empty
            }
            if (e.getKeyCode() == KeyEvent.VK_DOWN) {
                // if current row is the last one
                if (m_TestRequirementTable.getSelectedRow() == m_TestRequirementTable.getRowCount() - 1) {
                    addNewRow();
                }
            }
            if ((e.getKeyCode() == KeyEvent.VK_S) && (e.isControlDown())) {
                save();
            }
            if ((e.getKeyCode() == KeyEvent.VK_C) && (e.isControlDown())) {
                copySelectionToClipboard();
            }
            if ((e.getKeyCode() == KeyEvent.VK_V) && (e.isControlDown())) {
                if (m_TestRequirementTable.getSelectedColumn() != 0) {
                    pasteSelectionFromClipboard();
                }
            }
        }
    });

    tableListener = new TableModelListener() {

        public void tableChanged(TableModelEvent e) {
            // build the test data
            if (e.getType() == TableModelEvent.UPDATE) {
                if (e.getFirstRow() >= 0) {
                    setModified(true);
                }
            }
        }
    };
    m_TestRequirementModel.addTableModelListener(tableListener);

    JScrollPane sp = new JScrollPane(m_TestRequirementTable);
    sp.addMouseListener(new TableMouseListener(null));
    add(sp);
}

From source file:cl.almejo.vsim.gui.SimWindow.java

private void addMenu() {
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = newMenu(Messages.t("menu.file"), KeyEvent.VK_F, menuBar);
    menu.add(newMenuItem(NEW_ACTION, Messages.c("menu.file.new.mnemonic")));
    menu.add(newMenuItem(OPEN_ACTION, Messages.c("menu.file.open.mnemonic")));
    menu.add(newMenuItem(SAVE_ACTION, Messages.c("menu.file.save.mnemonic")));
    menu.add(newMenuItem(SAVE_AS_ACTION, Messages.c("menu.file.saveas.mnemonic")));
    menu.addSeparator();//from   www . j  ava  2  s  .  c  o  m
    menu.add(newMenuItem(QUIT_ACTION, Messages.c("menu.file.quit.mnemonic")));

    menu = newMenu(Messages.t("menu.edit"), KeyEvent.VK_F, menuBar);
    menu.add(newMenuItem(CUT_ACTION, Messages.c("menu.edit.cut.mnemonic")));
    menu.add(newMenuItem(COPY_ACTION, Messages.c("menu.edit.copy.mnemonic")));
    menu.add(newMenuItem(PASTE_ACTION, Messages.c("menu.edit.paste.mnemonic")));
    menu.add(newMenuItem(UNDO_ACTION, Messages.c("menu.edit.undo.mnemonic")));
    menu.add(newMenuItem(REDO_ACTION, Messages.c("menu.edit.redo.mnemonic")));
    menu.add(newMenuItem(PREFERENCES_ACTION, Messages.c("menu.edit.preferences.mnemonic")));

    menu = newMenu(Messages.t("menu.view"), KeyEvent.VK_V, menuBar);
    menu.add(newCheckboxMenuItem(SHOW_GRID_ACTION, Messages.c("menu.view.grid.mnemonic"), true));

    menu = newMenu(Messages.t("menu.tools"), KeyEvent.VK_H, menuBar);
    menu.add(newMenuItem(CURSOR_TOOL_ACTION, Messages.c("menu.tool.cursor.mnemonic")));
    menu.add(newMenuItem(MOVE_VIEWPORT_TOOL_ACTION, Messages.c("menu.tool.move.viewport.mnemonic")));
    menu.add(newMenuItem(WIRES_TOOL_ACTION, Messages.c("menu.tool.wires.mnemonic")));
    menu.add(newMenuItem(AND2_TOOL_ACTION, Messages.c("menu.tool.and2.mnemonic")));
    menu.add(newMenuItem(AND3_TOOL_ACTION, Messages.c("menu.tool.and3.mnemonic")));
    menu.add(newMenuItem(AND4_TOOL_ACTION, Messages.c("menu.tool.and4.mnemonic")));

    menu.add(newMenuItem(OR2_TOOL_ACTION, Messages.c("menu.tool.or2.mnemonic")));
    menu.add(newMenuItem(OR3_TOOL_ACTION, Messages.c("menu.tool.or3.mnemonic")));
    menu.add(newMenuItem(OR4_TOOL_ACTION, Messages.c("menu.tool.or4.mnemonic")));

    menu.add(newMenuItem(XOR2_TOOL_ACTION, Messages.c("menu.tool.or2.mnemonic")));
    menu.add(newMenuItem(XOR3_TOOL_ACTION, Messages.c("menu.tool.or3.mnemonic")));
    menu.add(newMenuItem(XOR4_TOOL_ACTION, Messages.c("menu.tool.or4.mnemonic")));

    menu.add(newMenuItem(CLOCK_TOOL_ACTION, Messages.c("menu.tool.clock.mnemonic")));
    menu.add(newMenuItem(NOT_TOOL_ACTION, Messages.c("menu.tool.not.mnemonic")));
    menu.add(newMenuItem(FLIP_FLOP_DATA_TOOL_ACTION, Messages.c("menu.tool.flip.flop.data.mnemonic")));
    menu.add(newMenuItem(TRISTATE_TOOL_ACTION, Messages.c("menu.tool.tristate.mnemonic")));
    menu.add(newMenuItem(SEVEN_SEGMENTS_DISPLAY_TOOL_ACTION,
            Messages.c("menu.tool.seven.segments.display.mnemonic")));
    menu.add(newMenuItem(SEVEN_SEGMENTS_DISPLAY_DOUBLE_TOOL_ACTION,
            Messages.c("menu.tool.seven.segments.display.double.mnemonic")));
    menu.add(newMenuItem(LED_TOOL_ACTION, Messages.c("menu.tool.led.mnemonic")));
    menu.add(newMenuItem(TIME_DIAGRAM_TOOL_ACTION, Messages.c("menu.tool.time.diagram.mnemonic")));
    menu.add(newMenuItem(SWITCH_TOOL_ACTION, Messages.c("menu.tool.switch.mnemonic")));

    menu = newMenu(Messages.t("menu.simulation"), KeyEvent.VK_F, menuBar);
    menu.add(newMenuItem(START_ACTION, Messages.c("menu.simulation.start.mnemonic")));
    menu.add(newMenuItem(PAUSE_ACTION, Messages.c("menu.simulation.pause.mnemonic")));

    menu = newMenu(Messages.t("menu.window"), KeyEvent.VK_F, menuBar);
    menu.add(newMenuItem(CLONE_WINDOW_ACTION, Messages.c("menu.window.clone.mnemonic")));
    menu.add(newMenuItem(CLOSE_ACTION, Messages.c("menu.window.close.mnemonic")));

    menu = newMenu(Messages.t("menu.help"), KeyEvent.VK_F, menuBar);
    menu.add(newMenuItem(ONLINE_HELP_ACTION, Messages.c("menu.help.online.mnemonic")));
    menu.add(newMenuItem(ABOUT_ACTION, Messages.c("menu.help.about.mnemonic")));

    setJMenuBar(menuBar);
}

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

/**
 * Build main menu./*from www. j a  v a2s.  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);
}