Example usage for javax.swing JMenu JMenu

List of usage examples for javax.swing JMenu JMenu

Introduction

In this page you can find the example usage for javax.swing JMenu JMenu.

Prototype

public JMenu(Action a) 

Source Link

Document

Constructs a menu whose properties are taken from the Action supplied.

Usage

From source file:org.fhaes.jsea.JSEAFrame.java

/**
 * Setup menu bar/* ww w  . ja v a  2s.c  om*/
 */
private void setupMenu() {

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);
    {
        JMenu mnFile = new JMenu("File");
        menuBar.add(mnFile);
        {
            JMenuItem mntmClose = new JMenuItem(actionFileExit);

            {
                JMenuItem mntmNew = new JMenuItem(actionReset);
                mnFile.add(mntmNew);
            }
            {
                mnSave = new JMenu("Save");
                mnSave.setIcon(Builder.getImageIcon("save.png"));
                mnFile.add(mnSave);
                {
                    JMenuItem mntmChart = new JMenuItem(actionSaveChart);
                    mnSave.add(mntmChart);
                }
                {
                    JMenuItem mntmReport = new JMenuItem(actionSaveReport);
                    mnSave.add(mntmReport);
                }
                {
                    JMenuItem mntmData = new JMenuItem(actionSaveData);
                    mnSave.add(mntmData);
                }
                mnSave.addSeparator();
                {
                    JMenuItem mntmAll = new JMenuItem(actionSaveAll);
                    mnSave.add(mntmAll);
                }
            }
            mnFile.addSeparator();
            mnFile.add(mntmClose);
        }
    }
    {
        JMenu mnEdit = new JMenu("Edit");
        menuBar.add(mnEdit);
        {
            JMenuItem mntmCopy = new JMenuItem(actionCopy);
            mnEdit.add(mntmCopy);

            JMenuItem mntmChartProperties = new JMenuItem(actionChartProperties);
            mnEdit.add(mntmChartProperties);

            mnEdit.addSeparator();
            JMenuItem mntmRun = new JMenuItem(actionRun);
            mnEdit.add(mntmRun);
        }
    }
    {
        JMenu mnTools = new JMenu("Tools");
        menuBar.add(mnTools);
        {
            JMenuItem mntmLagMap = new JMenuItem(actionLagMap);
            mnTools.add(mntmLagMap);

        }
    }
    {
        JMenu mnHelp = new JMenu("Help");
        menuBar.add(mnHelp);
        {
            JMenuItem mntmHelp = new JMenuItem(MainWindow.actionHelp);
            mnHelp.add(mntmHelp);
        }
        mnHelp.addSeparator();
        {
            JMenuItem mntmAbout = new JMenuItem(MainWindow.actionAbout);
            mnHelp.add(mntmAbout);
        }
    }
}

From source file:electroStaticUI.ElectroStaticUIContainer.java

private void buildFileMenu() {
    //create Exit menu item
    exitItem = new JMenuItem("Exit");
    exitItem.setMnemonic(KeyEvent.VK_X);
    exitItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            System.exit(0);// w w w .j a  va2  s.c o  m
        }
    });

    //open
    open = new JMenuItem("Open");
    open.setMnemonic(KeyEvent.VK_P);
    open.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fChooser = new JFileChooser();
            int status = fChooser.showSaveDialog(null);
        }
    });

    //close
    close = new JMenuItem("Close");
    close.setMnemonic(KeyEvent.VK_C);

    //export
    export = new JMenuItem("Export");
    export.setMnemonic(KeyEvent.VK_E);
    export.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fChooser = new JFileChooser();
            fChooser.setMultiSelectionEnabled(false);
            fChooser.setAcceptAllFileFilterUsed(false);
            FileNameExtensionFilter svgFilter = new FileNameExtensionFilter("Save Vector Plot(svg)", ".svg");
            FileNameExtensionFilter pngFilter = new FileNameExtensionFilter("Save Voltage Surface Plot(png)",
                    ".png");
            fChooser.addChoosableFileFilter(svgFilter);
            fChooser.addChoosableFileFilter(pngFilter);
            fChooser.setFileFilter(svgFilter);
            int status = fChooser.showSaveDialog(rootPane);
            if (status == JFileChooser.APPROVE_OPTION) {
                if (fChooser.getFileFilter() == svgFilter) {
                    try {
                        saveAsName = fChooser.getSelectedFile().getCanonicalPath();
                        Save.saveChartToSVG(DefaultValues.getChartToSave(), saveAsName, displayPanel.getWidth(),
                                displayPanel.getHeight());
                    } catch (IOException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                } else if (fChooser.getFileFilter() == pngFilter) {
                    try {
                        saveAsName = fChooser.getSelectedFile().getCanonicalPath();
                        Save.saveChart3dToPNG(DefaultValues.get3dChartToSave(), saveAsName);
                    } catch (IOException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                }
            }
        }
    });

    //save
    save = new JMenuItem("Save");
    save.setMnemonic(KeyEvent.VK_S);
    save.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fChooser = new JFileChooser();
            int status = fChooser.showSaveDialog(null);
            if (status == JFileChooser.APPROVE_OPTION) {
                try {
                    System.out.println("Height: " + displayPanel.getWidth());
                    System.out.println("Width: " + displayPanel.getHeight());
                    saveAsName = fChooser.getSelectedFile().getCanonicalPath();
                    Save.saveChartToSVG(DefaultValues.getChartToSave(), saveAsName, displayPanel.getWidth(),
                            displayPanel.getHeight());
                } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
            }

        }
    });

    //saveAs
    saveAs = new JMenuItem("Save As");
    saveAs.setMnemonic(KeyEvent.VK_A);
    saveAs.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JFileChooser fChooser = new JFileChooser();
            int status = fChooser.showSaveDialog(null);
            if (status == JFileChooser.APPROVE_OPTION)
                try {
                    System.out.println("Height: " + displayPanel.getWidth());
                    System.out.println("Width: " + displayPanel.getHeight());
                    saveAsName = fChooser.getSelectedFile().getCanonicalPath();
                    System.out.println(saveAsName);
                    Save.saveChartToSVG(DefaultValues.getChartToSave(), saveAsName, displayPanel.getWidth(),
                            displayPanel.getHeight());
                } catch (IOException e2) {
                    // TODO Auto-generated catch block
                    e2.printStackTrace();
                }
            try {
                Save.saveChartToSVG(UserInput.getElectricFieldChart(), saveAsName, displayPanel.getWidth(),
                        displayPanel.getHeight());
            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
    });

    //JMenu object for file menu
    fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);

    //fileMenu.add(newFile);
    //fileMenu.add(open);
    //fileMenu.add(close);
    fileMenu.add(export);
    //fileMenu.add(save);
    //fileMenu.add(saveAs);
    fileMenu.add(exitItem);
}

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

private JMenu createFileMenu() {

    JMenu file_menu = new JMenu("File");

    file_menu.add(theActionManager.get("print"));

    return file_menu;

}

From source file:qmod.generator.MainWindow.java

@SuppressWarnings("unchecked")
public MainWindow() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setTitle("Quick Mod Generator");

    JLabel lblAuthors = new JLabel("Authors:");

    authorField1 = new JTextField();
    authorField1.setColumns(25);/*from w  w w . j av a2  s .c o m*/

    JButton btnGenerateFile = new JButton("Generate File");
    btnGenerateFile.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            writeFiles();
        }
    });

    authCombo1.setFont(new Font("Dialog", Font.BOLD, 8));
    authCombo1.setModel(
            (ComboBoxModel<Object>) new DefaultComboBoxModel<Object>(new String[] { "Author", "Maintainer" }));
    authCombo1.setSelectedIndex(0);

    authCombo2.setFont(new Font("Dialog", Font.BOLD, 8));
    authCombo2.setModel(
            (ComboBoxModel<Object>) new DefaultComboBoxModel<Object>(new String[] { "Author", "Maintainer" }));
    authCombo2.setSelectedIndex(0);

    authorField2 = new JTextField();
    authorField2.setColumns(25);

    authCombo3.setFont(new Font("Dialog", Font.BOLD, 8));
    authCombo3.setModel(
            (ComboBoxModel<Object>) new DefaultComboBoxModel<Object>(new String[] { "Author", "Maintainer" }));
    authCombo3.setSelectedIndex(0);

    authorField3 = new JTextField();
    authorField3.setColumns(25);

    JLabel lblCategories = new JLabel("Categories:");

    categoriesField = new JTextField();
    categoriesField.setColumns(10);

    JLabel lblDescription = new JLabel("Description:");

    JEditorPane descriptionField = new JEditorPane();

    JLabel lblLicense = new JLabel("License:");

    licenseField = new JTextField();
    licenseField.setColumns(10);
    GroupLayout groupLayout = new GroupLayout(getContentPane());
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
                            .createSequentialGroup()
                            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
                                    .createParallelGroup(Alignment.TRAILING).addComponent(btnGenerateFile)
                                    .addGroup(groupLayout.createSequentialGroup().addComponent(lblAuthors)
                                            .addPreferredGap(ComponentPlacement.RELATED).addGroup(groupLayout
                                                    .createParallelGroup(Alignment.LEADING).addGroup(groupLayout
                                                            .createSequentialGroup()
                                                            .addComponent(
                                                                    authCombo2, GroupLayout.PREFERRED_SIZE, 81,
                                                                    GroupLayout.PREFERRED_SIZE)
                                                            .addGap(6).addComponent(authorField2,
                                                                    GroupLayout.PREFERRED_SIZE, 192,
                                                                    GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(groupLayout.createSequentialGroup().addComponent(
                                                            authCombo1, GroupLayout.PREFERRED_SIZE, 81,
                                                            GroupLayout.PREFERRED_SIZE).addPreferredGap(
                                                                    ComponentPlacement.RELATED)
                                                            .addComponent(
                                                                    authorField1, GroupLayout.DEFAULT_SIZE, 264,
                                                                    Short.MAX_VALUE))
                                                    .addGroup(groupLayout.createSequentialGroup()
                                                            .addComponent(authCombo3,
                                                                    GroupLayout.PREFERRED_SIZE, 81,
                                                                    GroupLayout.PREFERRED_SIZE)
                                                            .addGap(6).addGroup(groupLayout.createParallelGroup(
                                                                    Alignment.LEADING).addComponent(
                                                                            descriptionField)
                                                                    .addGroup(groupLayout
                                                                            .createParallelGroup(
                                                                                    Alignment.LEADING, false)
                                                                            .addComponent(categoriesField)
                                                                            .addComponent(
                                                                                    authorField3,
                                                                                    GroupLayout.DEFAULT_SIZE,
                                                                                    192, Short.MAX_VALUE))
                                                                    .addGroup(groupLayout
                                                                            .createSequentialGroup()
                                                                            .addComponent(licenseField,
                                                                                    GroupLayout.DEFAULT_SIZE,
                                                                                    192, Short.MAX_VALUE)
                                                                            .addPreferredGap(
                                                                                    ComponentPlacement.RELATED)))))))
                                    .addComponent(lblCategories).addComponent(lblDescription))
                            .addGap(84))
                            .addGroup(groupLayout.createSequentialGroup().addComponent(lblLicense)
                                    .addContainerGap(377, Short.MAX_VALUE)))));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout
            .createSequentialGroup().addContainerGap()
            .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(lblAuthors)
                    .addComponent(authorField1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(authCombo1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                    .addComponent(authCombo2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addGroup(groupLayout.createSequentialGroup().addGap(3).addComponent(authorField2,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                    .addComponent(authCombo3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addGroup(groupLayout.createSequentialGroup().addGap(3).addComponent(authorField3,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(lblCategories)
                    .addComponent(categoriesField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(lblDescription)
                    .addComponent(descriptionField, GroupLayout.PREFERRED_SIZE, 100,
                            GroupLayout.PREFERRED_SIZE))
            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                    .addGroup(groupLayout.createSequentialGroup().addGap(9).addComponent(lblLicense))
                    .addGroup(groupLayout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED)
                            .addComponent(licenseField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)))
            .addPreferredGap(ComponentPlacement.RELATED, 322, Short.MAX_VALUE).addComponent(btnGenerateFile)
            .addContainerGap()));
    getContentPane().setLayout(groupLayout);

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu mnFile = new JMenu("File");
    mnFile.setMnemonic('F');
    menuBar.add(mnFile);

    JMenuItem mntmNew = new JMenuItem("New");
    mntmNew.setMnemonic(KeyEvent.VK_N);
    mnFile.add(mntmNew);

    JMenuItem mntmOpen = new JMenuItem("Open");
    mnFile.add(mntmOpen);

    JMenuItem mntmSave = new JMenuItem("Save");
    mnFile.add(mntmSave);

    JMenuItem mntmExit = new JMenuItem("Exit");
    mntmExit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            System.exit(0);
        }
    });
    mntmExit.setMnemonic(KeyEvent.VK_X);
    mnFile.add(mntmExit);
}

From source file:edu.umich.robot.GuiApplication.java

/**
 * Entry point.//from w w w  . j  a  v a 2s. c  o m
 * 
 * @param args Args from command line.
 */
public GuiApplication(Config config) {
    // Heavyweight is not desirable but it is the only thing that will
    // render in front of the Viewer on all platforms. Blame OpenGL
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);

    // must have config
    //Config config = (args.length > 0) ? ConfigUtil.getDefaultConfig(args) : promptForConfig(frame);
    if (config == null)
        System.exit(1);

    // Add more stuff to the config file that doesn't change between runs.
    Application.setupSimulatorConfig(config);
    setupViewerConfig(config);

    Configs.toLog(logger, config);

    controller = new Controller(config, new Gamepad());
    controller.initializeGamepad();

    viewer = new Viewer(config, frame);
    // This puts us in full 3d mode by default. The Viewer GUI doesn't
    // reflect this in its right click drop-down, a bug.
    viewer.getVisCanvas().getViewManager().setInterfaceMode(3);

    controller.addListener(RobotAddedEvent.class, listener);
    controller.addListener(RobotRemovedEvent.class, listener);
    controller.addListener(AfterResetEvent.class, listener);
    controller.addListener(ControllerActivatedEvent.class, listener);
    controller.addListener(ControllerDeactivatedEvent.class, listener);

    actionManager = new ActionManager(this);
    initActions();

    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosed(WindowEvent e) {
            controller.shutdown();
            System.exit(0);
        }
    });
    frame.setLayout(new BorderLayout());

    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    fileMenu.add(actionManager.getAction(CreateSplinterRobotAction.class));
    fileMenu.add(actionManager.getAction(CreateSuperdroidRobotAction.class));
    fileMenu.add(new JSeparator());
    fileMenu.add(actionManager.getAction(ConnectSuperdroidAction.class));
    fileMenu.add(new JSeparator());
    fileMenu.add(actionManager.getAction(ResetPreferencesAction.class));

    /*
    fileMenu.add(new JSeparator());
    fileMenu.add(actionManager.getAction(TextMessageAction.class));
    */

    fileMenu.add(new JSeparator());
    fileMenu.add(actionManager.getAction(SaveMapAction.class));
    fileMenu.add(new JSeparator());
    fileMenu.add(actionManager.getAction(ExitAction.class));
    menuBar.add(fileMenu);

    JMenu cameraMenu = new JMenu("Camera");
    cameraMenu.add(actionManager.getAction(DisableFollowAction.class));
    cameraMenu.add(actionManager.getAction(FollowPositionAction.class));
    cameraMenu.add(actionManager.getAction(FollowPositionAndThetaAction.class));
    cameraMenu.add(new JSeparator());
    cameraMenu.add(actionManager.getAction(MoveCameraBehindAction.class));
    cameraMenu.add(actionManager.getAction(MoveCameraAboveAction.class));
    menuBar.add(cameraMenu);

    JMenu objectMenu = new JMenu("Objects");
    boolean added = false;
    for (String objectName : controller.getObjectNames()) {
        added = true;
        objectMenu.add(new AddObjectAction(this, objectName));
    }
    if (!added)
        objectMenu.add(new JLabel("No objects available"));
    menuBar.add(objectMenu);

    menuBar.revalidate();
    frame.setJMenuBar(menuBar);

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setRollover(true);
    toolBar.add(actionManager.getAction(SoarParametersAction.class));
    toolBar.add(actionManager.getAction(SoarDataAction.class));
    toolBar.add(actionManager.getAction(ResetAction.class));
    toolBar.add(actionManager.getAction(SoarToggleAction.class));
    toolBar.add(actionManager.getAction(SoarStepAction.class));
    toolBar.add(actionManager.getAction(SimSpeedAction.class));
    frame.add(toolBar, BorderLayout.PAGE_START);

    viewerView = new ViewerView(viewer.getVisCanvas());
    robotsView = new RobotsView(this, actionManager);

    final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, viewerView, robotsView);
    splitPane.setDividerLocation(0.75);

    // TODO SoarApril
    /*
    viewer.addRobotSelectionChangedListener(robotsView);
    viewer.getVisCanvas().setDrawGround(true);
    */

    viewer.getVisCanvas().addEventHandler(new VisCanvasEventAdapter() {

        public String getName() {
            return "Place Object";
        }

        @Override
        public boolean mouseClicked(VisCanvas vc, GRay3D ray, MouseEvent e) {
            boolean ret = false;
            synchronized (GuiApplication.this) {
                if (objectToAdd != null && controller != null) {
                    controller.addObject(objectToAdd, ray.intersectPlaneXY());
                    objectToAdd = null;
                    ret = true;
                } else {
                    double[] click = ray.intersectPlaneXY();
                    chatView.setClick(new Point2D.Double(click[0], click[1]));
                }
            }
            status.setMessage(
                    String.format("%3.1f,%3.1f", ray.intersectPlaneXY()[0], ray.intersectPlaneXY()[1]));
            return ret;
        }
    });

    consoleView = new ConsoleView();
    chatView = new ChatView(this);
    controller.getRadio().addRadioHandler(chatView);

    final JSplitPane bottomPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, consoleView, chatView);
    bottomPane.setDividerLocation(200);

    final JSplitPane splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, splitPane, bottomPane);
    splitPane2.setDividerLocation(0.75);

    frame.add(splitPane2, BorderLayout.CENTER);

    status = new StatusBar();
    frame.add(status, BorderLayout.SOUTH);

    /*
    frame.addWindowListener(new WindowAdapter() {
    @Override
    public void windowClosing(WindowEvent e)
    {
        final Preferences windowPrefs = getWindowPreferences();
        final Rectangle r = frame.getBounds();
        if(frame.getExtendedState() == JFrame.NORMAL)
        {
            windowPrefs.putInt("x", r.x);
            windowPrefs.putInt("y", r.y);
            windowPrefs.putInt("width", r.width);
            windowPrefs.putInt("height", r.height);
            windowPrefs.putInt("divider", splitPane.getDividerLocation());
        }
                
        exit();
    }});
            
    Preferences windowPrefs = getWindowPreferences();
    if (windowPrefs.get("x", null) != null)
    {
    frame.setBounds(
            windowPrefs.getInt("x", 0), 
            windowPrefs.getInt("y", 0), 
            windowPrefs.getInt("width", 1200), 
            windowPrefs.getInt("height", 900));
    splitPane.setDividerLocation(windowPrefs.getInt("divider", 500));
    }
    else
    {
    frame.setBounds(
            windowPrefs.getInt("x", 0), 
            windowPrefs.getInt("y", 0), 
            windowPrefs.getInt("width", 1200), 
            windowPrefs.getInt("height", 900));
    splitPane.setDividerLocation(0.75);
    frame.setLocationRelativeTo(null); // center
    }
    */

    frame.getRootPane().setBounds(0, 0, 1600, 1200);

    frame.getRootPane().registerKeyboardAction(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            frame.dispose();
        }
    }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);

    frame.pack();

    frame.setVisible(true);

    for (String s : config.getStrings("splinters", new String[0])) {
        double[] pos = config.getDoubles(s + ".position");
        if (pos == null) {
            logger.error("Splinter indexed in config file but no position defined: " + s);
            continue;
        }

        Pose pose = new Pose(pos);
        String prods = config.getString(s + ".productions");
        boolean collisions = config.getBoolean(s + ".wallCollisions", true);

        controller.createSplinterRobot(s, pose, collisions);
        boolean simulated = config.getBoolean(s + ".simulated", true);
        if (simulated)
            controller.createSimSplinter(s);
        else
            controller.createRealSplinter(s);
        controller.createSimLaser(s);
        if (prods != null) {
            controller.createSoarController(s, s, prods, config.getChild(s + ".properties"));
            PREFERENCES.put("lastProductions", prods);
        }
    }

    for (String s : config.getStrings("superdroids", new String[0])) {
        double[] pos = config.getDoubles(s + ".position");
        if (pos == null) {
            logger.error("Superdroid indexed in config file but no position defined: " + s);
            continue;
        }

        Pose pose = new Pose(pos);
        String prods = config.getString(s + ".productions");
        boolean collisions = config.getBoolean(s + ".wallCollisions", true);

        controller.createSuperdroidRobot(s, pose, collisions);
        boolean simulated = config.getBoolean(s + ".simulated", true);
        if (simulated)
            controller.createSimSuperdroid(s);
        else {
            try {
                controller.createRealSuperdroid(s, "192.168.1.165", 3192);
            } catch (UnknownHostException e1) {
                e1.printStackTrace();
            } catch (SocketException e1) {
                e1.printStackTrace();
            }
        }
        controller.createSimLaser(s);
        if (prods != null) {
            // wait a sec
            try {
                Thread.sleep(1000);
            } catch (InterruptedException ex) {
            }
            controller.createSoarController(s, s, prods, config.getChild(s + ".properties"));
            PREFERENCES.put("lastProductions", prods);
        }
    }

}

From source file:misc.TextBatchPrintingDemo.java

/**
 * Create and display the main application frame.
 *///from   ww  w. ja va 2  s  .c om
void createAndShowGUI() {
    messageArea = new JLabel(defaultMessage);

    selectedPages = new JList(new DefaultListModel());
    selectedPages.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    selectedPages.addListSelectionListener(this);

    setPage(homePage);

    JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(pageItem),
            new JScrollPane(selectedPages));

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

    /** Menu item and keyboard shortcuts for the "add page" command.  */
    fileMenu.add(createMenuItem(new AbstractAction("Add Page") {
        public void actionPerformed(ActionEvent e) {
            DefaultListModel pages = (DefaultListModel) selectedPages.getModel();
            pages.addElement(pageItem);
            selectedPages.setSelectedIndex(pages.getSize() - 1);
        }
    }, KeyEvent.VK_A, KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.ALT_MASK)));

    /** Menu item and keyboard shortcuts for the "print selected" command.*/
    fileMenu.add(createMenuItem(new AbstractAction("Print Selected") {
        public void actionPerformed(ActionEvent e) {
            printSelectedPages();
        }
    }, KeyEvent.VK_P, KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.ALT_MASK)));

    /** Menu item and keyboard shortcuts for the "clear selected" command.*/
    fileMenu.add(createMenuItem(new AbstractAction("Clear Selected") {
        public void actionPerformed(ActionEvent e) {
            DefaultListModel pages = (DefaultListModel) selectedPages.getModel();
            pages.removeAllElements();
        }
    }, KeyEvent.VK_C, KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.ALT_MASK)));

    fileMenu.addSeparator();

    /** Menu item and keyboard shortcuts for the "home page" command.  */
    fileMenu.add(createMenuItem(new AbstractAction("Home Page") {
        public void actionPerformed(ActionEvent e) {
            setPage(homePage);
        }
    }, KeyEvent.VK_H, KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK)));

    /** Menu item and keyboard shortcuts for the "quit" command.  */
    fileMenu.add(createMenuItem(new AbstractAction("Quit") {
        public void actionPerformed(ActionEvent e) {
            for (Window w : Window.getWindows()) {
                w.dispose();
            }
        }
    }, KeyEvent.VK_A, KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)));

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);

    JPanel contentPane = new JPanel();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    contentPane.add(pane);
    contentPane.add(messageArea);

    JFrame frame = new JFrame("Text Batch Printing Demo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setJMenuBar(menuBar);
    frame.setContentPane(contentPane);
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);

    if (printService == null) {
        // Actual printing is not possible, issue a warning message.
        JOptionPane.showMessageDialog(frame, "No default print service", "Print Service Alert",
                JOptionPane.WARNING_MESSAGE);
    }
}

From source file:TopLevelTransferHandlerDemo.java

private JMenu createDummyMenu(String str) {
    JMenu menu = new JMenu(str);
    JMenuItem item = new JMenuItem("[Empty]");
    item.setEnabled(false);//from  ww w  . j av  a  2  s .co m
    menu.add(item);
    return menu;
}

From source file:livecanvas.mesheditor.MeshEditor.java

public JMenuBar createMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    JMenu menu, subMenu;//from   ww w .jav a  2 s.c om
    JMenuItem menuItem;
    menu = new JMenu("File");
    menu.setMnemonic(KeyEvent.VK_F);
    menu.add(menuItem = Utils.createMenuItem("New", NEW, KeyEvent.VK_N, "ctrl N", this));
    menu.add(menuItem = Utils.createMenuItem("Open...", OPEN, KeyEvent.VK_O, "ctrl O", this));
    menu.add(menuItem = Utils.createMenuItem("Save", SAVE, KeyEvent.VK_S, "ctrl S", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Exit", EXIT, KeyEvent.VK_X, "", this));
    menuBar.add(menu);
    menu = new JMenu("Edit");
    menu.setMnemonic(KeyEvent.VK_E);
    menu.add(menuItem = Utils.createMenuItem("Undo", UNDO, KeyEvent.VK_U, "ctrl Z", this));
    menu.add(menuItem = Utils.createMenuItem("Redo", REDO, KeyEvent.VK_R, "ctrl Y", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Cut", CUT, KeyEvent.VK_T, "ctrl X", this));
    menu.add(menuItem = Utils.createMenuItem("Copy", COPY, KeyEvent.VK_C, "ctrl C", this));
    menu.add(menuItem = Utils.createMenuItem("Paste", PASTE, KeyEvent.VK_P, "ctrl V", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Select All", SELECT_ALL, KeyEvent.VK_A, "ctrl A", this));
    menu.add(menuItem = Utils.createMenuItem("Invert Selection", INVERT_SELECTION, 0, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Settings...", SETTINGS, KeyEvent.VK_S, "", this));
    menuBar.add(menu);
    menu = new JMenu("Tools");
    menu.setMnemonic(KeyEvent.VK_T);
    menu.add(menuItem = Utils.createMenuItem("Brush", TOOLS_BRUSH, KeyEvent.VK_B, "B", this));
    menu.add(menuItem = Utils.createMenuItem("Pencil", TOOLS_PEN, KeyEvent.VK_N, "N", this));
    menu.add(menuItem = Utils.createMenuItem("Magic Wand", TOOLS_MAGICWAND, KeyEvent.VK_W, "W", this));
    menu.add(menuItem = Utils.createMenuItem("Set Control Points", TOOLS_SETCONTROLPOINTS, KeyEvent.VK_C, "C",
            this));
    menu.add(menuItem = Utils.createMenuItem("Pointer", TOOLS_POINTER, KeyEvent.VK_P, "P", this));
    menu.add(menuItem = Utils.createMenuItem("Pan / Zoom", TOOLS_PANZOOM, KeyEvent.VK_Z, "Z", this));
    menuBar.add(menu);
    menu = new JMenu("Layers");
    menu.setMnemonic(KeyEvent.VK_L);
    menu.add(menuItem = Utils.createMenuItem("Add Layer...", ADD_LAYER, KeyEvent.VK_A, "", this));
    menu.add(menuItem = Utils.createMenuItem("Remove", REMOVE_LAYER, KeyEvent.VK_R, "", this));
    menu.add(menuItem = Utils.createMenuItem("Duplicate", DUPLICATE_LAYER, KeyEvent.VK_C, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Move Up", MOVEUP_LAYER, KeyEvent.VK_U, "", this));
    menu.add(menuItem = Utils.createMenuItem("Move Down", MOVEDOWN_LAYER, KeyEvent.VK_D, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Reparent Layer...", REPARENT_LAYER, KeyEvent.VK_R, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Group Layers", GROUP_LAYERS, KeyEvent.VK_G, "", this));
    menu.add(menuItem = Utils.createMenuItem("Ungroup Layer", UNGROUP_LAYER, KeyEvent.VK_N, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Join Layers", JOIN_LAYERS, KeyEvent.VK_J, "", this));
    menu.add(menuItem = Utils.createMenuItem("Intersect", INTERSECT_LAYERS, KeyEvent.VK_I, "", this));
    menu.add(menuItem = Utils.createMenuItem("Subtract", SUBTRACT_LAYERS, KeyEvent.VK_S, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Rename...", RENAME_LAYER, KeyEvent.VK_E, "", this));
    menu.addSeparator();
    subMenu = new JMenu("Background Reference");
    subMenu.add(menuItem = Utils.createMenuItem("Set...", BGREF_SET, KeyEvent.VK_S, "", this));
    subMenu.add(menuItem = Utils.createMenuItem("Remove", BGREF_REMOVE, KeyEvent.VK_R, "", this));
    menu.add(subMenu);
    menuBar.add(menu);
    menu.addSeparator();
    menu.add(menuItem = Utils.createMenuItem("Create Mesh Grid", CREATE_MESHGRID, KeyEvent.VK_M, "", this));
    menu.addSeparator();
    menu.add(menuItem = Utils.createCheckBoxMenuItem("See Through", SEE_THROUGH, KeyEvent.VK_T, "", this));
    menuItem.setSelected(true);
    menu.add(menuItem = Utils.createCheckBoxMenuItem("Show Mesh", SHOW_MESH, KeyEvent.VK_M, "", this));
    menuItem.setSelected(true);
    return menuBar;
}

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

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

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

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

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

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

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

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

    menu.addSeparator();

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

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

    menuBar.add(menu);

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

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

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

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

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

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

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

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

    menu.addSeparator();

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

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

    menuBar.add(menu);

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

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

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

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

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

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

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

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

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

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

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

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

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

    JCheckBoxMenuItem checkboxMenuItem;
    ButtonGroup colorSchemeGroup;

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

    menu.addSeparator();

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

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

    }
    menu.add(submenu);

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

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

    menu.add(checkboxMenuItem);

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

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

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

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

    menu.addSeparator();

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

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

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

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

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

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

    menu.addSeparator();

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

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

    menuBar.add(menu);

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

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

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

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

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

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

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

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

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

    menu.addSeparator();

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

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

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

                        JOptionPane.ERROR_MESSAGE);
                return;
            }

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

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

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

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

    menu.add(submenu);

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

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

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

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

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

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

    menu.add(submenu);

    menuBar.add(menu);

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

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

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

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

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

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

    menu.addSeparator();

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

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

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

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

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

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

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

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

    menuBar.add(menu);

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

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

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

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

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

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

    menu.addSeparator();

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

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

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

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

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

    menuBar.add(menu);

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

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

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

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

    menu.addSeparator();

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

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

    menu.addSeparator();

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

    menuBar.add(menu);

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

    menuBar.add(Box.createHorizontalGlue());

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

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

    menu.addSeparator();

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

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

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

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

    menu.addSeparator();

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

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

    menuBar.add(menu);
}

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

private JMenu createEditMenu() {

    JMenu edit_menu = new JMenu("Edit");
    edit_menu.setMnemonic(KeyEvent.VK_E);
    edit_menu.add(theActionManager.get("undo"));
    edit_menu.add(theActionManager.get("redo"));
    edit_menu.addSeparator();//from   ww w.j ava2  s .c o m
    edit_menu.add(theActionManager.get("cut"));
    edit_menu.add(theActionManager.get("copy"));
    edit_menu.add(theActionManager.get("delete"));
    edit_menu.add(theActionManager.get("screenshot"));
    edit_menu.addSeparator();
    edit_menu.add(theActionManager.get("selectall"));
    edit_menu.add(theActionManager.get("selectnone"));
    edit_menu.addSeparator();
    edit_menu.add(theActionManager.get("enlarge"));
    edit_menu.add(theActionManager.get("resetsize"));
    edit_menu.add(theActionManager.get("shrink"));
    edit_menu.addSeparator();
    edit_menu.add(theActionManager.get("group"));
    edit_menu.add(theActionManager.get("ungroup"));
    edit_menu.addSeparator();
    edit_menu.add(theActionManager.get("placestructures"));

    return edit_menu;
}