Example usage for javax.swing JCheckBoxMenuItem addActionListener

List of usage examples for javax.swing JCheckBoxMenuItem addActionListener

Introduction

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

Prototype

public void addActionListener(ActionListener l) 

Source Link

Document

Adds an ActionListener to the button.

Usage

From source file:net.sf.jabref.gui.openoffice.OpenOfficePanel.java

private void showSettingsPopup() {
    JPopupMenu menu = new JPopupMenu();
    final JCheckBoxMenuItem autoSync = new JCheckBoxMenuItem(
            Localization.lang("Automatically sync bibliography when inserting citations"),
            preferences.syncWhenCiting());
    final JRadioButtonMenuItem useActiveBase = new JRadioButtonMenuItem(
            Localization.lang("Look up BibTeX entries in the active tab only"));
    final JRadioButtonMenuItem useAllBases = new JRadioButtonMenuItem(
            Localization.lang("Look up BibTeX entries in all open databases"));
    final JMenuItem clearConnectionSettings = new JMenuItem(Localization.lang("Clear connection settings"));
    ButtonGroup bg = new ButtonGroup();
    bg.add(useActiveBase);//  w w w. j a  v a 2  s .c  o  m
    bg.add(useAllBases);
    if (preferences.useAllDatabases()) {
        useAllBases.setSelected(true);
    } else {
        useActiveBase.setSelected(true);
    }

    autoSync.addActionListener(e -> preferences.setSyncWhenCiting(autoSync.isSelected()));

    useAllBases.addActionListener(e -> preferences.setUseAllDatabases(useAllBases.isSelected()));

    useActiveBase.addActionListener(e -> preferences.setUseAllDatabases(!useActiveBase.isSelected()));

    clearConnectionSettings.addActionListener(e -> frame.output(preferences.clearConnectionSettings()));

    menu.add(autoSync);
    menu.addSeparator();
    menu.add(useActiveBase);
    menu.add(useAllBases);
    menu.addSeparator();
    menu.add(clearConnectionSettings);
    menu.show(settingsB, 0, settingsB.getHeight());
}

From source file:ucar.unidata.idv.control.chart.ChartWrapper.java

/**
 * Add the default menu items/*w  ww.  ja  v  a  2 s .c  o  m*/
 *
 *
 * @param items List of menu items
 *
 * @return The items list
 */
protected List getPopupMenuItems(List items) {

    if (canDoParameters()) {
        items.add(GuiUtils.makeMenuItem("Add Field...", this, "addField"));
    }

    if (canDoJython() && (jython != null) && (jython.trim().length() > 0)) {
        items.add(GuiUtils.makeMenuItem("Apply Jython", this, "applyJython", jython));

    }

    items.add(GuiUtils.makeMenuItem("Remove Chart", this, "removeDisplayComponent"));

    items.add(GuiUtils.MENU_SEPARATOR);
    items.add(GuiUtils.makeMenuItem("Save Image...", this, "doSaveImage"));
    items.add(GuiUtils.makeMenuItem("Save Movie...", this, "doSaveMovie"));

    if (canDoDriveTime()) {
        items.add(GuiUtils.MENU_SEPARATOR);

        final JCheckBoxMenuItem mi1 = new JCheckBoxMenuItem("Show Animation Times", showTime);
        items.add(mi1);
        mi1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                showTime = mi1.isSelected();
            }
        });

        final JCheckBoxMenuItem mi2 = new JCheckBoxMenuItem("Drive Animation Times", driveTime);
        items.add(mi2);
        mi2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                driveTime = mi2.isSelected();
            }
        });

    }

    if (canDoTimeFilters() && (getDisplayGroup() != null)) {
        List comps = getDisplayGroup().getAncestorGroup().findDisplayComponents(ChartWrapper.class);
        JMenu filterMenu = null;
        boolean didSep = false;
        if (timeFilterSource != null) {
            filterMenu = new JMenu("Time Subset");
            didSep = true;
            items.add(GuiUtils.MENU_SEPARATOR);
            items.add(filterMenu);
            filterMenu.add(GuiUtils.makeMenuItem("Remove", ChartWrapper.this, "removeTimeFilterSource"));
        }

        for (int i = 0; i < comps.size(); i++) {
            ChartWrapper chartWrapper = (ChartWrapper) comps.get(i);
            if (chartWrapper.getTimeRanges() == null) {
                continue;
            }
            if (filterMenu == null) {
                filterMenu = new JMenu("Time Subset");
                if (!didSep) {
                    items.add(GuiUtils.MENU_SEPARATOR);
                }
                didSep = true;
                items.add(filterMenu);
            }
            filterMenu.add(GuiUtils.makeMenuItem("From: " + chartWrapper.getName(), ChartWrapper.this,
                    "setTimeFilterSource", chartWrapper));
        }

    }

    if (canDoTimeSelect() && (getDisplayGroup() != null)) {
        List comps = getDisplayGroup().getAncestorGroup().findDisplayComponents(ChartWrapper.class);
        JMenu filterMenu = null;
        boolean didSep = false;
        if (timeSelectSource != null) {
            filterMenu = new JMenu("Time Select");
            didSep = true;
            items.add(GuiUtils.MENU_SEPARATOR);
            items.add(filterMenu);
            filterMenu.add(GuiUtils.makeMenuItem("Remove", ChartWrapper.this, "removeTimeSelectSource"));
        }

        for (int i = 0; i < comps.size(); i++) {
            ChartWrapper chartWrapper = (ChartWrapper) comps.get(i);
            if ((chartWrapper == this) || !chartWrapper.canBeASourceForTimeSelectionEvents()) {
                continue;
            }

            if (filterMenu == null) {
                filterMenu = new JMenu("Time Select");
                if (!didSep) {
                    items.add(GuiUtils.MENU_SEPARATOR);
                }
                didSep = true;
                items.add(filterMenu);
            }
            filterMenu.add(GuiUtils.makeMenuItem("From: " + chartWrapper.getName(), ChartWrapper.this,
                    "setTimeSelectSource", chartWrapper));
        }

    }

    items.add(GuiUtils.MENU_SEPARATOR);
    items.add(GuiUtils.makeMenuItem("Properties...", this, "showProperties"));

    return items;

}

From source file:net.sf.jabref.openoffice.OpenOfficePanel.java

private void showSettingsPopup() {
    JPopupMenu menu = new JPopupMenu();
    final JCheckBoxMenuItem autoSync = new JCheckBoxMenuItem(
            Localization.lang("Automatically sync bibliography when inserting citations"),
            Globals.prefs.getBoolean(JabRefPreferences.SYNC_OO_WHEN_CITING));
    final JRadioButtonMenuItem useActiveBase = new JRadioButtonMenuItem(
            Localization.lang("Look up BibTeX entries in the active tab only"));
    final JRadioButtonMenuItem useAllBases = new JRadioButtonMenuItem(
            Localization.lang("Look up BibTeX entries in all open databases"));
    final JMenuItem clearConnectionSettings = new JMenuItem(Localization.lang("Clear connection settings"));
    ButtonGroup bg = new ButtonGroup();
    bg.add(useActiveBase);/*ww w  . j  av  a  2 s .  co  m*/
    bg.add(useAllBases);
    if (Globals.prefs.getBoolean(JabRefPreferences.USE_ALL_OPEN_BASES)) {
        useAllBases.setSelected(true);
    } else {
        useActiveBase.setSelected(true);
    }

    autoSync.addActionListener(
            e -> Globals.prefs.putBoolean(JabRefPreferences.SYNC_OO_WHEN_CITING, autoSync.isSelected()));

    useAllBases.addActionListener(
            e -> Globals.prefs.putBoolean(JabRefPreferences.USE_ALL_OPEN_BASES, useAllBases.isSelected()));

    useActiveBase.addActionListener(
            e -> Globals.prefs.putBoolean(JabRefPreferences.USE_ALL_OPEN_BASES, !useActiveBase.isSelected()));

    clearConnectionSettings.addActionListener(e -> {

        Globals.prefs.clear(JabRefPreferences.OO_PATH);
        Globals.prefs.clear(JabRefPreferences.OO_EXECUTABLE_PATH);
        Globals.prefs.clear(JabRefPreferences.OO_JARS_PATH);
        frame.output(Localization.lang("Cleared connection settings."));

    });

    menu.add(autoSync);
    menu.addSeparator();
    menu.add(useActiveBase);
    menu.add(useAllBases);
    menu.addSeparator();
    menu.add(clearConnectionSettings);
    menu.show(settingsB, 0, settingsB.getHeight());
}

From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java

private JMenuBar initMenuBar() {
    JMenuBar menubar = new JMenuBar();
    {/*w  w w .jav a 2 s.co  m*/
        JMenu menu = new JMenu("Synchronisation");
        {
            JMenuItem m = new JMenuItem("Kurse auswhlen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    chooseCourses();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Automatische Synchronisation");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    showAutoSyncSettings();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Neue Dateien zeigen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    showNewFiles();
                }
            });
            menu.add(m);
        }
        menubar.add(menu);
    }
    {
        JMenu menu = new JMenu("Einstellungen");
        {
            JMenuItem m = new JMenuItem("Speicherpfad ndern");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    changeBaseDir();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Speicherpfad ffnen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openBaseDir();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Maximale Dateigre ndern");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    changeMaxFileSize();
                }
            });
            menu.add(m);
        }
        {
            final JCheckBoxMenuItem menuitem = new JCheckBoxMenuItem(
                    "Benachrichtigungen im Systemtray anzeigen");
            menuitem.setSelected(iliasProperties.isShowNotifications());
            menuitem.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    iliasProperties.setShowNotifications(!iliasProperties.isShowNotifications());
                    saveProperties(iliasProperties);
                    menuitem.setSelected(iliasProperties.isShowNotifications());
                }
            });
            menu.add(menuitem);
        }
        {
            menu.add(new JSeparator());
        }
        {
            JMenuItem m = new JMenuItem("Design ndern");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    changeLookAndFeel();
                }
            });
            menu.add(m);
        }
        {
            menu.add(new JSeparator());
        }
        {
            JMenuItem m = new JMenuItem("Server einstellen");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    chooseServer();
                }
            });
            menu.add(m);
        }
        menubar.add(menu);
    }
    {
        JMenu menu = new JMenu("Hilfe");
        {
            JMenuItem m = new JMenuItem("Fehler melden, Feedback geben");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openFeedbackPage();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Webseite");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openWebsite();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Android App");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    openAndroidWebsite();
                }
            });
            menu.add(m);
        }
        {
            JMenuItem m = new JMenuItem("Info");
            m.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    showInfo();
                }
            });
            menu.add(m);
        }
        menubar.add(menu);
    }
    return menubar;
}

From source file:homenetapp.HomeNetAppGui.java

private void startHomeNetApp() {

    this.addWindowListener(new java.awt.event.WindowAdapter() {

        public void windowClosing(java.awt.event.WindowEvent winEvt) {
            // Perhaps ask user if they want to save any unsaved files first.
            exit();//w w w  .  jav a 2 s. c o m
        }
    });

    homenetapp.homenet.addPortListener(new homenet.PortListener() {

        ArrayList<String> local = new ArrayList<String>();
        ArrayList<String> remote = new ArrayList<String>();

        private boolean isRemote(String port) {
            return port.equals("xmlrpc");
        }

        public void portAdded(String port) {
            // System.out.println("portAddedEvent");
            if (isRemote(port)) {
                remote.add(port);
                remoteStatusLabel.setText("Connected");
            } else {
                local.add(port);
                localStatusLabel.setText("Connected");
            }
        }

        public void portRemoved(String port) {
            //System.out.println("portRemovedEvent");
            if (isRemote(port)) {
                remote.remove(port);
                if (remote.size() < 1) {
                    remoteStatusLabel.setText("Not Connected");
                }
            } else {
                local.remove(port);
                if (local.size() < 1) {
                    localStatusLabel.setText("Not Connected");
                }
            }
        }

        public void portSendingStart(String port) {
            // System.out.println("portSendingStartEvent");
            if (isRemote(port)) {
                remoteSendingLabel.setText("(X)");
            } else {
                localSendingLabel.setText("(X)");
            }
        }

        public void portSendingEnd(String port) {
            // System.out.println("portSendingEndEvent");
            if (isRemote(port)) {
                Thread delayThread = new Thread() {
                    public void run() {
                        try {
                            Thread.sleep(500);
                        } catch (Exception e) {
                        }
                        remoteSendingLabel.setText("( )");
                    }
                };
                delayThread.start();

            } else {
                Thread delayThread = new Thread() {
                    public void run() {
                        try {
                            Thread.sleep(500);
                        } catch (Exception e) {
                        }
                        localSendingLabel.setText("( )");
                    }
                };
                delayThread.start();

            }
        }

        public void portReceivingStart(String port) {
            //  System.out.println("portRecievingStartEvent");
            if (isRemote(port)) {
                remoteReceivingLabel.setText("(X)");
            } else {
                localReceivingLabel.setText("(X)");
            }
        }

        public void portReceivingEnd(String port) {
            //   System.out.println("portRecievingEndEvent");
            if (isRemote(port)) {
                Thread delayThread = new Thread() {
                    public void run() {
                        try {
                            Thread.sleep(500);
                        } catch (Exception e) {
                        }
                        remoteReceivingLabel.setText("( )");
                    }
                };
                delayThread.start();

            } else {
                Thread delayThread = new Thread() {
                    public void run() {
                        try {
                            Thread.sleep(500);
                        } catch (Exception e) {
                        }
                        localReceivingLabel.setText("( )");
                    }
                };
                delayThread.start();

            }
        }
    });

    try {
        homenetapp.start();
    } catch (Exception e) {
        //show popup and exit program
        javax.swing.JOptionPane.showMessageDialog(null, "Error: " + e.getMessage(), "Error",
                javax.swing.JOptionPane.ERROR_MESSAGE);
        System.err.println(e.getMessage());
    }

    loadSettings();

    SendPacketFrame.setLocationRelativeTo(null);

    homenetapp.homenet.addPacketListener(new homenet.PacketListener() {

        public void packetRecieved(homenet.Packet packet) {
            addPacketToList(packet);
        }
    });

    homenetapp.serialmanager.addListener(new SerialListener() {

        public void portAdded(String name) {
            //    System.out.println("portAddedEvent");

            javax.swing.JCheckBoxMenuItem serialPortCheckBox = new javax.swing.JCheckBoxMenuItem(name);

            serialPortCheckBox.addActionListener(new java.awt.event.ActionListener() {

                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    JCheckBoxMenuItem checkbox = (JCheckBoxMenuItem) evt.getSource();
                    if (checkbox.isSelected()) {
                        try {
                            homenetapp.serialmanager.activatePort(checkbox.getText());
                        } catch (Exception e) {
                            javax.swing.JOptionPane.showMessageDialog(null,
                                    "Port " + checkbox.getText() + " Error: " + e.getMessage(), "Error",
                                    javax.swing.JOptionPane.ERROR_MESSAGE);
                        }
                    } else {
                        homenetapp.serialmanager.deactivatePort(checkbox.getText());
                    }
                }
            });

            // serialPortCheckBox.setMnemonic(java.awt.event.KeyEvent.VK_1);
            menuItems.put(name, serialPortCheckBox);
            menuSerialPorts.add(serialPortCheckBox);

        }

        public void portRemoved(String name) {
            // System.out.println("portRemovedEvent");
            menuSerialPorts.remove(menuItems.get(name));
        }

        public void portActivated(String name) {
            //  System.out.println("portActivatedEvent");
            menuItems.get(name).setSelected(true);

        }

        public void portDeactivated(String name) {
            //  System.out.println("portDeactivatedEvent");
            menuItems.get(name).setSelected(false);
        }
    });

    try {
        homenetapp.serialmanager.start();
    } catch (Exception e) {
        javax.swing.JOptionPane.showMessageDialog(null, "Port Error: " + e.getMessage(), "Error",
                javax.swing.JOptionPane.ERROR_MESSAGE);
    }
}

From source file:com.declarativa.interprolog.gui.ListenerWindow.java

void constructMenu() {
    JMenuBar mb;/*  w  ww  .ja  v  a2  s  . c  om*/
    mb = new JMenuBar();
    setJMenuBar(mb);

    final CallsFromArgBuilder2XSB calls2XSB = new CallsFromArgBuilder2XSB();

    /**
     * ****************************************************************
     * ***************ENTRY POINT FOR CALLING THE ARGXSB ANALYSIS *****
     * ****************************************************************
     *
     * Carga un archivo con las reglas para crear los argumentos
     */
    loadRules = new JMenu("");
    loadRules.setMnemonic('A');
    mb.add(loadRules);
    addItemToMenu(loadRules, "Select a Program", 'S', new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            //jLayeredPane1.setVisible(true);
            //WORKFLOW:
            //1. Load File
            //2. clause partition
            //3. graph creation
            //4. extract subgraphs
            //5. create a file for each subgraph
            //6. consult via XSB, each sub-file (sub-graph)
            /**
             * deleteing previous files
             */
            String calls_for_table = "";//maybe temporal
            String returns_for_call = "";

            //the file is loaded
            GraphAnalysis();

            try {
                ReDrawGraph();
            } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
                //System.out.println("EXCEPCION EN REDRAW CALL");
            }

            /*
             //remueve el .P del archivo 
             String nameFile = calls2XSB.File2Consult(getNameOfFileToLoad());
             System.out.println("=============_" + nameFile);
             //StringTokenizer st2 = new StringTokenizer(getNameOfFileToLoad(), ".");
             //String nameFile = st2.nextElement().toString();
             sendCallToProlog("consult(" + nameFile + ").");
                    
                    
             //retorna los valores de True False de cada atomo
             //estos debeian guardarse en la base de datos para luego
             // obtener los argumentos
             calls_for_table = calls2XSB.FindCallsForTable(engine);
             returns_for_call = calls2XSB.FindReturnsForCall(engine);
             */
            java.util.List<String> filenames = new ArrayList();
            filenames = printArguments();

            for (Iterator<String> it = filenames.iterator(); it.hasNext();) {
                String string = it.next();
                //System.out.println("\t\t --------------> name:" + string);
                //System.out.println("\t \t *************************************************");

                /*
                 try {
                 System.out.println(new File(".").getCanonicalPath());
                 System.out.println("DIR:" + new File("../examples/").getCanonicalPath());
                 System.out.println("DIR:" + new File("../examples/"+string).getCanonicalPath());
                        
                 } catch (java.io.IOException ex) {
                 System.out.println("ex." + ex.getLocalizedMessage());
                 }
                 */
                consultFile("../examples/" + string);

                String nameFile3 = calls2XSB.File2Consult(string);
                //sendCallToProlog("consult(" + nameFile3 + ").");
                sendCallToProlog(nameFile3);

                //calls_for_table = calls2XSB.FindCallsForTable(engine);
                //returns_for_call = calls2XSB.FindReturnsForCall(engine, string);
                calls2XSB.WFSEvaluation(engine, string);

                //System.out.println("\t \t *************************************************");
            }

            ArgumentWriter();

            drawArguments();

            /*
             String atomGoal ="p(X)";
             String atomGoal2 = "findall(Y,p(Y), L)";
             String atomGoal3 ="findall(Call,get_calls_for_table(p/1,Call),List)";
             String atomGoal4 ="findall(Answer,get_returns_for_call(p(_),Answer),List2)";
                    
                    
             try {
             String G = "(X=a;X=b)";
             String T = "X";
                       
             String GG = "findall(TM, ("+atomGoal3+",buildTermModel(List,TM)), L), ipObjectSpec('ArrayOfObject',L,LM)";                   
             String GG2 = "findall(TM, ("+atomGoal4+",buildTermModel(List2,TM)), L), ipObjectSpec('ArrayOfObject',L,LM)";
                    
             Object[] bindings0 = engine.deterministicGoal(atomGoal,null);                  
             Object[] bindings = engine.deterministicGoal(atomGoal3,null);
                    
             Object[] get_calls_for_table = (Object[])engine.deterministicGoal(GG,"[LM]")[0];                    
             Object[] get_returns_for_call = (Object[])engine.deterministicGoal(GG2,"[LM]")[0];
                    
             //System.out.println("Number of solutions:"+get_calls_for_table.length);
             for(int I=0;I<get_calls_for_table.length;I++)
             System.out.println("Solution "+I+":"+get_calls_for_table[I]);
                    
             //System.out.println("Number of bindings:"+get_returns_for_call.length);
             for(int I=0;I<get_returns_for_call.length;I++)
             System.out.println("Solution2 "+I+":"+get_returns_for_call[I]);
                      
                    
             } catch (IPAbortedException exc) {
             exc.printStackTrace();
             System.out.println("Exception!: "+exc.getLocalizedMessage());
             } catch (IPInterruptedException ex) {
             ex.printStackTrace();
             System.out.println("Exception!: "+ex.getLocalizedMessage());
             }
                    
             */
        }
    });

    fileMenu = new JMenu("File");
    fileMenu.setMnemonic('F');
    //        mb.add(fileMenu);

    addItemToMenu(fileMenu, "Consult...", 'C', new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            reconsultFile();
        }
    });

    if (engine.getImplementationPeer() instanceof XSBPeer) {
        addItemToMenu(fileMenu, "Load dynamically...", 'L', new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                load_dynFile();
            }
        });
    }

    fileMenu.addSeparator();

    JMenu toolMenu = new JMenu("Tools");
    toolMenu.setMnemonic('T');
    //       mb.add(toolMenu);

    final JCheckBoxMenuItem debugging = new JCheckBoxMenuItem("Engine debugging");
    toolMenu.add(debugging);
    debugging.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            engine.setDebug(debugging.isSelected());
        }
    });

    addItemToMenu(toolMenu, "See Object Specifications", 'S', new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            engine.command("showObjectVariables");
        }
    });

    addItemToMenu(toolMenu, "Interrupt Prolog", 'I', new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            engine.interrupt();
        }
    });
    /*
     addItemToMenu(toolMenu,"Serialize JFrame",new ActionListener(){
     public void actionPerformed(ActionEvent e){
     Object [] toSerialize = {new JFrame("My window")};
     engine.setDebug(true);
     System.out.println(engine.deterministicGoal("true","[Object]",toSerialize));
     }
     });*/

    historyMenu = new JMenu("History", true);
    historyMenu.setMnemonic('H');
    //        mb.add(historyMenu);
    historyMenu.addSeparator(); // to avoid Swing bug handling key events
}

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

/**
 * Build menu items for TA./*from  w  w  w  .ja v a2  s.  com*/
 */
private void buildTAMenuItems() {
    final int[] days = { 14, 28, 50, 100, 200 };
    final MACD.Period[] macd_periods = { MACD.Period.newInstance(12, 26, 9) };

    // day_keys, week_keys and month_keys should be having same length as
    // days.        
    final String[] day_keys = { "ChartJDialog_14Days", "ChartJDialog_28Days", "ChartJDialog_50Days",
            "ChartJDialog_100Days", "ChartJDialog_200Days" };
    final String[] week_keys = { "ChartJDialog_14Weeks", "ChartJDialog_28Weeks", "ChartJDialog_50Weeks",
            "ChartJDialog_100Weeks", "ChartJDialog_200Weeks" };
    final String[] month_keys = { "ChartJDialog_14Months", "ChartJDialog_28Months", "ChartJDialog_50Months",
            "ChartJDialog_100Months", "ChartJDialog_200Months" };
    assert (days.length == day_keys.length);
    assert (days.length == week_keys.length);
    assert (days.length == week_keys.length);
    // macd_day_keys, macd_week_keys and macd_month_keys should be having 
    // same length as macd_periods.
    final String[] macd_day_keys = { "ChartJDialog_12_26_9Days" };
    final String[] macd_week_keys = { "ChartJDialog_12_26_9Weeks" };
    final String[] macd_month_keys = { "ChartJDialog_12_26_9Months" };
    assert (macd_periods.length == macd_day_keys.length);
    assert (macd_periods.length == macd_week_keys.length);
    assert (macd_periods.length == macd_month_keys.length);

    String[] keys = null;
    String[] macd_keys = null;
    if (this.getCurrentInterval() == Interval.Daily) {
        keys = day_keys;
        macd_keys = macd_day_keys;
    } else if (this.getCurrentInterval() == Interval.Weekly) {
        keys = week_keys;
        macd_keys = macd_week_keys;
    } else if (this.getCurrentInterval() == Interval.Monthly) {
        keys = month_keys;
        macd_keys = macd_month_keys;
    } else {
        assert (false);
    }
    final TA[] tas = TA.values();
    final String[] ta_keys = { "ChartJDialog_SMA", "ChartJDialog_EMA", "ChartJDialog_MACD", "ChartJDialog_RSI",
            "ChartJDialog_MFI", "ChartJDialog_CCI" };
    final String[] ta_tip_keys = { "ChartJDialog_SimpleMovingAverage", "ChartJDialog_ExponentialMovingAverage",
            "ChartJDialog_MovingAverageConvergenceDivergence", "ChartJDialog_RelativeStrengthIndex",
            "ChartJDialog_MoneyFlowIndex", "ChartJDialog_CommodityChannelIndex" };
    final String[] custom_message_keys = { "info_message_please_enter_number_of_days_for_SMA",
            "info_message_please_enter_number_of_days_for_EMA", "dummy",
            "info_message_please_enter_number_of_days_for_RSI",
            "info_message_please_enter_number_of_days_for_MFI",
            "info_message_please_enter_number_of_days_for_CCI" };
    final Map<TA, Set<Object>> m = new EnumMap<TA, Set<Object>>(TA.class);
    final int taExSize = JStock.instance().getChartJDialogOptions().getTAExSize();
    for (int i = 0; i < taExSize; i++) {
        final TAEx taEx = JStock.instance().getChartJDialogOptions().getTAEx(i);
        if (m.containsKey(taEx.getTA()) == false) {
            m.put(taEx.getTA(), new HashSet<Object>());
        }
        m.get(taEx.getTA()).add(taEx.getParameter());
    }

    for (int i = 0, length = tas.length; i < length; i++) {
        final TA ta = tas[i];
        javax.swing.JMenu menu = new javax.swing.JMenu();
        menu.setText(GUIBundle.getString(ta_keys[i])); // NOI18N
        menu.setToolTipText(GUIBundle.getString(ta_tip_keys[i])); // NOI18N

        if (ta == TA.MACD) {
            for (int j = 0, length2 = macd_periods.length; j < length2; j++) {
                final int _j = j;
                final javax.swing.JCheckBoxMenuItem item = new javax.swing.JCheckBoxMenuItem();
                item.setText(GUIBundle.getString(macd_keys[j]));
                if (m.containsKey(ta)) {
                    if (m.get(ta).contains(macd_periods[_j])) {
                        item.setSelected(true);
                    }
                }
                item.addActionListener(new java.awt.event.ActionListener() {
                    @Override
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        if (ta == TA.MACD) {
                            updateMACD(macd_periods[_j], item.isSelected());
                        }
                    }
                });
                menu.add(item);
            }
        } else {
            for (int j = 0, length2 = days.length; j < length2; j++) {
                final int _j = j;
                final javax.swing.JCheckBoxMenuItem item = new javax.swing.JCheckBoxMenuItem();
                item.setText(GUIBundle.getString(keys[j])); // NOI18N
                if (m.containsKey(ta)) {
                    if (m.get(ta).contains(days[_j])) {
                        item.setSelected(true);
                    }
                }
                item.addActionListener(new java.awt.event.ActionListener() {
                    @Override
                    public void actionPerformed(java.awt.event.ActionEvent evt) {
                        if (ta == TA.SMA) {
                            updateSMA(days[_j], item.isSelected());
                        } else if (ta == TA.EMA) {
                            updateEMA(days[_j], item.isSelected());
                        } else if (ta == TA.MFI) {
                            updateMFI(days[_j], item.isSelected());
                        } else if (ta == TA.RSI) {
                            updateRSI(days[_j], item.isSelected());
                        } else if (ta == TA.CCI) {
                            updateCCI(days[_j], item.isSelected());
                        }
                    }
                });
                menu.add(item);
            } // for
        } // if (ta == TA.MACD)

        menu.add(new javax.swing.JSeparator());
        javax.swing.JMenuItem item = new javax.swing.JMenuItem();
        item.setText(GUIBundle.getString("ChartJDialog_Custom...")); // NOI18N
        final int _i = i;
        item.addActionListener(new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                if (ta == TA.MACD) {
                    showMACDCustomDialog();
                } else {
                    do {
                        final String days_string = JOptionPane.showInputDialog(ChartJDialog.this,
                                MessagesBundle.getString(custom_message_keys[_i]));
                        if (days_string == null) {
                            return;
                        }
                        try {
                            final int days = Integer.parseInt(days_string);
                            if (days <= 0) {
                                JOptionPane.showMessageDialog(ChartJDialog.this,
                                        MessagesBundle.getString("info_message_number_of_days_required"),
                                        MessagesBundle.getString("info_title_number_of_days_required"),
                                        JOptionPane.WARNING_MESSAGE);
                                continue;
                            }
                            ChartJDialog.this.updateTA(ta, days, true);
                            return;
                        } catch (java.lang.NumberFormatException exp) {
                            log.error(null, exp);
                            JOptionPane.showMessageDialog(ChartJDialog.this,
                                    MessagesBundle.getString("info_message_number_of_days_required"),
                                    MessagesBundle.getString("info_title_number_of_days_required"),
                                    JOptionPane.WARNING_MESSAGE);
                            continue;
                        }
                    } while (true);
                }
            }
        });
        menu.add(item);

        // TEMP DISABLE MACD
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        if (ta != TA.MACD) {
            this.jMenu2.add(menu);
        }
    } // for
    this.jMenu2.add(new javax.swing.JSeparator());
    javax.swing.JMenuItem item = new javax.swing.JMenuItem();
    item.setText(GUIBundle.getString("ChartJDialog_ClearAll")); // NOI18N
    item.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ChartJDialog.this.clearAll();
        }
    });
    this.jMenu2.add(item);
}

From source file:edu.ku.brc.ui.UIHelper.java

/**
 * Creates a Localized JCheckBoxMenuItem.
 * @param labelKey//from w  w  w.j av  a2 s. c  om
 * @param mnemonicKey
 * @param accessibleDescriptionKey
 * @param enabled
 * @param action
 * @return
 */
public static JCheckBoxMenuItem createLocalizedCheckBoxMenuItem(final String labelKey, final String mnemonicKey,
        final String accessibleDescriptionKey, final boolean enabled, final AbstractAction action) {
    JCheckBoxMenuItem mi = new JCheckBoxMenuItem(getResourceString(labelKey));
    setLocalizedMnemonic(mi, getResourceString(mnemonicKey));

    if (isNotEmpty(accessibleDescriptionKey)) {
        mi.getAccessibleContext().setAccessibleDescription(getResourceString(accessibleDescriptionKey));
    }
    if (action != null) {
        mi.addActionListener(action);
        action.addPropertyChangeListener(new MenuItemPropertyChangeListener(mi));
        action.setEnabled(enabled);
    }

    return mi;
}

From source file:edu.ku.brc.ui.UIHelper.java

/**
 * Creates a JCheckBoxMenuItem.//from  w ww . j  a v  a  2 s . co m
 * @param menu parent menu
 * @param label the label of the menu item
 * @param mnemonic the mnemonic
 * @param accessibleDescription the accessible Description
 * @param enabled enabled
 * @param action the aciton
 * @return menu item
 */
public static JCheckBoxMenuItem createCheckBoxMenuItem(final JMenu menu, final String label,
        final String mnemonic, final String accessibleDescription, final boolean enabled,
        final AbstractAction action) {
    JCheckBoxMenuItem mi = new JCheckBoxMenuItem(getResourceString(label));
    if (menu != null) {
        menu.add(mi);
    }
    setLocalizedMnemonic(mi, mnemonic);

    if (isNotEmpty(accessibleDescription)) {
        mi.getAccessibleContext().setAccessibleDescription(accessibleDescription);
    }
    if (action != null) {
        mi.addActionListener(action);
        action.addPropertyChangeListener(new MenuItemPropertyChangeListener(mi));
        action.setEnabled(enabled);
    }

    return mi;
}

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

/**
 * Build main menu.//ww w  .  j  a  va 2 s .com
 * 
 * @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);
}