Example usage for java.awt.event KeyEvent VK_N

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

Introduction

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

Prototype

int VK_N

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

Click Source Link

Document

Constant for the "N" key.

Usage

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

/**
 * Build main menu./*from w  w w. ja  v a 2  s.  c  om*/
 * 
 * @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.photovault.swingui.BrowserWindow.java

protected void createUI(PhotoCollection collection) {
    window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    tabPane = new JTabbedPane();
    queryPane = new QueryPane();
    PhotoFolderTreeController treeCtrl = new PhotoFolderTreeController(window, this);
    viewCtrl = new PhotoViewController(window, this);
    treePane = treeCtrl.folderTree;//from  ww  w  . j a  va 2  s .c  om
    viewPane = viewCtrl.getThumbPane();
    previewPane = viewCtrl.getPreviewPane();
    tabPane.addTab("Query", queryPane);
    tabPane.addTab("Folders", treePane);

    VolumeTreeController volTreeCtrl = new VolumeTreeController(this);
    JTree volumeTree = volTreeCtrl.getView();
    JScrollPane voltreeScrollPane = new JScrollPane(volumeTree);
    voltreeScrollPane.setPreferredSize(new Dimension(200, 500));
    tabPane.add("Volumes", voltreeScrollPane);

    // TODO: get rid of this!!!!
    EditSelectionColorsAction colorAction = (EditSelectionColorsAction) viewPane.getEditSelectionColorsAction();
    colorAction.setPreviewCtrl(previewPane);

    // Set listeners to both query and folder tree panes

    /*
    If an actionEvent comes from query pane, swich to query results.
     */
    queryPane.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setCollection(queryPane.getResultCollection());
        }
    });

    /*
    If the selected folder is changed in treePane, switch to that immediately
     */

    treeCtrl.registerEventListener(PhotoFolderTreeEvent.class, new DefaultEventListener<PhotoCollection>() {

        public void handleEvent(DefaultEvent<PhotoCollection> event) {
            PhotoCollection c = event.getPayload();
            if (c != null) {
                viewCtrl.setCollection(c);
                if (c instanceof PhotoFolder) {
                    PhotoFolder f = (PhotoFolder) c;

                    if (f.getExternalDir() != null) {
                        ExternalDir ed = f.getExternalDir();
                        folderIndexer.updateDir(ed.getVolume(), ed.getPath());
                        viewCtrl.setIndexingOngoing(true);
                    }
                }
            }
        }
    });

    volTreeCtrl.registerEventListener(PhotoFolderTreeEvent.class, new DefaultEventListener<PhotoCollection>() {

        public void handleEvent(DefaultEvent<PhotoCollection> event) {
            PhotoCollection c = event.getPayload();
            if (c != null) {
                viewCtrl.setCollection(c);
                if (c instanceof ExtDirPhotos) {
                    ExtDirPhotos photos = (ExtDirPhotos) c;
                    ExternalVolume vol = (ExternalVolume) viewCtrl.getDAOFactory().getVolumeDAO()
                            .getVolume(photos.getVolId());
                    folderIndexer.updateDir(vol, photos.getDirPath());
                    viewCtrl.setIndexingOngoing(true);
                }
            }
        }
    });

    collectionPane = viewCtrl.getCollectionPane();

    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tabPane, collectionPane);
    split.putClientProperty(JSplitPane.ONE_TOUCH_EXPANDABLE_PROPERTY, new Boolean(true));
    Container cp = window.getContentPane();
    cp.setLayout(new BorderLayout());
    cp.add(split, BorderLayout.CENTER);

    statusBar = new StatusBar();
    cp.add(statusBar, BorderLayout.SOUTH);

    // Create actions for BrowserWindow UI

    ImageIcon indexDirIcon = getIcon("index_dir.png");
    DefaultAction indexDirAction = new DefaultAction("Index directory...", indexDirIcon) {

        public void actionPerformed(ActionEvent e) {
            indexDir();
        }
    };
    indexDirAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_D);
    indexDirAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Index all images in a directory");
    this.registerAction("new_ext_vol", indexDirAction);

    ImageIcon importIcon = getIcon("import.png");
    importAction = new AbstractAction("Import image...", importIcon) {

        public void actionPerformed(ActionEvent e) {
            importFile();
        }
    };
    importAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_O);
    importAction.putValue(AbstractAction.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

    importAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Import new image into database");

    ImageIcon updateIcon = getIcon("update_indexed_dirs.png");
    UpdateIndexAction updateIndexAction = new UpdateIndexAction(viewCtrl, "Update indexed dirs", updateIcon,
            "Check for changes in previously indexed directories", KeyEvent.VK_U);
    this.registerAction("update_indexed_dirs", updateIndexAction);
    updateIndexAction.addStatusChangeListener(statusBar);

    ImageIcon previewTopIcon = getIcon("view_preview_top.png");
    DefaultAction previewTopAction = new DefaultAction("Preview on top", previewTopIcon) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setLayout(PhotoViewController.Layout.PREVIEW_HORIZONTAL_THUMBS);
        }
    };
    previewTopAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show preview on top of thumbnails");
    previewTopAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_T);
    this.registerAction("view_preview_top", previewTopAction);

    ImageIcon previewRightIcon = getIcon("view_preview_right.png");
    DefaultAction previewRightAction = new DefaultAction("Preview on right", previewRightIcon) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setLayout(PhotoViewController.Layout.PREVIEW_VERTICAL_THUMBS);
        }
    };
    previewRightAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show preview on right of thumbnails");
    previewRightAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_R);
    this.registerAction("view_preview_right", previewRightAction);

    ImageIcon previewNoneIcon = getIcon("view_no_preview.png");
    DefaultAction previewNoneAction = new DefaultAction("No preview", previewNoneIcon) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setLayout(PhotoViewController.Layout.ONLY_THUMBS);
        }
    };
    previewNoneAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Show no preview image");
    previewNoneAction.putValue(AbstractAction.MNEMONIC_KEY, KeyEvent.VK_O);
    this.registerAction("view_no_preview", previewNoneAction);

    DefaultAction previewLargeAction = new DefaultAction("Large", null) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setPreviewSize(200);
        }
    };
    DefaultAction previewSmallAction = new DefaultAction("Small", null) {

        public void actionPerformed(ActionEvent e) {
            viewCtrl.setPreviewSize(100);
        }
    };

    JToolBar tb = createToolbar();
    cp.add(tb, BorderLayout.NORTH);

    // Create the menu bar & menus
    JMenuBar menuBar = new JMenuBar();
    window.setJMenuBar(menuBar);
    // File menu
    JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);
    menuBar.add(fileMenu);

    JMenuItem newWindowItem = new JMenuItem("New window", KeyEvent.VK_N);
    newWindowItem.setIcon(getIcon("window_new.png"));
    newWindowItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            BrowserWindow br = new BrowserWindow(getParentController(), null);
            //          br.setVisible( true );
        }
    });
    fileMenu.add(newWindowItem);

    JMenuItem importItem = new JMenuItem(importAction);
    fileMenu.add(importItem);

    JMenuItem indexDirItem = new JMenuItem(indexDirAction);
    fileMenu.add(indexDirItem);

    fileMenu.add(new JMenuItem(viewCtrl.getActionAdapter("update_indexed_dirs")));

    ExportSelectedAction exportAction = (ExportSelectedAction) viewPane.getExportSelectedAction();
    JMenuItem exportItem = new JMenuItem(exportAction);
    exportAction.addStatusChangeListener(statusBar);
    fileMenu.add(exportItem);

    JMenu dbMenu = new JMenu("Database");
    dbMenu.setMnemonic(KeyEvent.VK_B);
    dbMenu.setIcon(getIcon("empty_icon.png"));

    ExportMetadataAction exportMetadata = new ExportMetadataAction("Export as XML...", null,
            "Export whole database as XML file", KeyEvent.VK_E);
    dbMenu.add(new JMenuItem(exportMetadata));

    ImportXMLAction importMetadata = new ImportXMLAction("Import XML data...", null,
            "Import data from other Photovault database as XML", KeyEvent.VK_I);
    importMetadata.addStatusChangeListener(statusBar);
    dbMenu.add(new JMenuItem(importMetadata));

    fileMenu.add(dbMenu);

    JMenuItem exitItem = new JMenuItem("Exit", KeyEvent.VK_X);
    exitItem.setIcon(getIcon("exit.png"));
    exitItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    fileMenu.add(exitItem);

    JMenu viewMenu = new JMenu("View");
    viewMenu.setMnemonic(KeyEvent.VK_V);
    menuBar.add(viewMenu);

    JMenuItem vertIconsItem = new JMenuItem(previewRightAction);
    viewMenu.add(vertIconsItem);

    JMenuItem horzIconsItem = new JMenuItem(previewTopAction);
    viewMenu.add(horzIconsItem);

    JMenuItem noPreviewItem = new JMenuItem(previewNoneAction);
    viewMenu.add(noPreviewItem);

    JMenuItem nextPhotoItem = new JMenuItem(viewPane.getSelectNextAction());
    viewMenu.add(nextPhotoItem);

    JMenuItem prevPhotoItem = new JMenuItem(viewPane.getSelectPreviousAction());
    viewMenu.add(prevPhotoItem);

    viewMenu.add(new JMenuItem(previewSmallAction));
    viewMenu.add(new JMenuItem(previewLargeAction));

    JMenu sortMenu = new JMenu("Sort by");
    sortMenu.setMnemonic(KeyEvent.VK_S);
    sortMenu.setIcon(getIcon("empty_icon.png"));
    JMenuItem byDateItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new ShootingDateComparator(), "Date",
            null, "Order photos by date", KeyEvent.VK_D));
    sortMenu.add(byDateItem);
    JMenuItem byPlaceItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new ShootingPlaceComparator(),
            "Place", null, "Order photos by shooting place", KeyEvent.VK_P));
    sortMenu.add(byPlaceItem);
    JMenuItem byQualityItem = new JMenuItem(new SetPhotoOrderAction(viewCtrl, new QualityComparator(),
            "Quality", null, "Order photos by quality", KeyEvent.VK_Q));
    sortMenu.add(byQualityItem);
    viewMenu.add(sortMenu);

    // Set default ordering by date
    byDateItem.getAction().actionPerformed(new ActionEvent(this, 0, "Setting default"));
    JMenu imageMenu = new JMenu("Image");
    imageMenu.setMnemonic(KeyEvent.VK_I);
    menuBar.add(imageMenu);

    imageMenu.add(new JMenuItem(viewPane.getEditSelectionPropsAction()));
    imageMenu.add(new JMenuItem(viewPane.getShowSelectedPhotoAction()));
    imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_cw")));
    imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_ccw")));
    imageMenu.add(new JMenuItem(viewCtrl.getActionAdapter("rotate_180")));
    imageMenu.add(new JMenuItem(previewPane.getCropAction()));
    imageMenu.add(new JMenuItem(viewPane.getEditSelectionColorsAction()));
    imageMenu.add(new JMenuItem(viewPane.getDeleteSelectedAction()));

    // Create the Quality submenu
    JMenu qualityMenu = new JMenu("Quality");
    qualityMenu.setIcon(getIcon("empty_icon.png"));

    for (int n = 0; n < 6; n++) {
        Action qualityAction = viewCtrl.getActionAdapter("quality_" + n);
        JMenuItem qualityMenuItem = new JMenuItem(qualityAction);
        qualityMenu.add(qualityMenuItem);
    }
    imageMenu.add(qualityMenu);

    JMenu aboutMenu = new JMenu("About");
    aboutMenu.setMnemonic(KeyEvent.VK_A);
    aboutMenu.add(new JMenuItem(new ShowAboutDlgAction("About Photovault...", null, "", null)));

    menuBar.add(Box.createHorizontalGlue());
    menuBar.add(aboutMenu);
    window.pack();
    window.setVisible(true);
}

From source file:eu.apenet.dpt.standalone.gui.DataPreparationToolGUI.java

private void setupTool() {
    LoggerJAXB.outputJaxpImplementationInfo();
    Locale currentLocale = Locale.getDefault();

    labels = new ResourceBundlesWrapper(I18N_BASENAMES, currentLocale);

    retrieveFromDb = new RetrieveFromDb();
    apePanel = new APEPanel(labels, getContentPane(), this, retrieveFromDb);

    Utilities.setXsdList(fillXsdList());

    CheckList checkList = new CheckList();
    langList = checkList.getLangList();//from   w w  w .  j av a 2  s .  c o m
    levelList = checkList.getLevelList();

    dateNormalization = new DateNormalization();

    super.setTitle(labels.getString("title"));
    Image topLeftIcon = Utilities.icon.getImage();
    setIconImage(topLeftIcon);

    doChecks();

    if (isFileMissing(Utilities.LOG_DIR)) {
        new File(Utilities.LOG_DIR).mkdir();
    }

    File tempDir = new File(Utilities.TEMP_DIR);
    //In case it didn't deleteOnExit at the previous closing of the program, we clean up.
    if (tempDir.exists()) {
        LOG.warn("Probably a problem when deleting the temp files at closure, so we clean up");
        eraseOldTempFiles(tempDir);
        try {
            FileUtils.deleteDirectory(tempDir);
        } catch (IOException e) {
            LOG.error("Could not delete the temp directory. Attempt to delete the directory once more: "
                    + (tempDir.delete() ? "Successful." : "Unsuccessful."));
        }
    }
    tempDir.mkdir();
    tempDir.deleteOnExit();
    //        ListControlaccessTerms listControlaccessTerms = new ListControlaccessTerms("/Users/yoannmoranville/Documents/Work/APE/data/AD78/");
    //        listControlaccessTerms.countTerms();
    //        listControlaccessTerms.displayLogsResults();
    //        CountCLevels countCLevels = new CountCLevels("/Users/yoannmoranville/Work/APEnet/Projects/data/Ready_APEnet/READY/Finland/HeNAF/FA_EAD/");
    //        CountCLevels countCLevels = new CountCLevels("/Users/yoannmoranville/Work/APEnet/Projects/data/BORA/ALL/");
    //        countCLevels.setCopyInAppropriateDirs(true);
    //        countCLevels.changeMainagencycodeForSweden(false);
    //        countCLevels.countLevels();

    //        SeparateFinnishFiles separateFinnishFiles = new SeparateFinnishFiles(new File("/Users/yoannmoranville/Desktop/files_fi"), TEMP_DIR);
    makeDefaultXsdMenuItems();
    makeDefaultXslMenuItems();

    getContentPane().add(apePanel);

    xmlEadListModel = new ProfileListModel(fileInstances, this);
    xmlEadList = new JList(xmlEadListModel);
    xmlEadList.setCellRenderer(new IconListCellRenderer(fileInstances));
    xmlEadList.setDragEnabled(true);

    xmlEadList.setTransferHandler(new ListTransferHandler());

    xmlEadList.setDropTarget(new DropTarget(xmlEadList, new ListDropTargetListener(xmlEadList, from)));
    xmlEadListModel.setList(xmlEadList);

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(fileMenu);
    menuBar.add(optionMenu);
    menuBar.add(actionMenu);
    menuBar.add(windowMenu);
    menuBar.add(helpMenu);
    fileItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    fileMenu.add(fileItem);

    closeSelectedItem.setEnabled(false);
    //        closeSelectedItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    closeSelectedItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_D, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    fileMenu.add(closeSelectedItem);
    saveSelectedItem.setEnabled(false);
    saveSelectedItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    fileMenu.add(saveSelectedItem);
    saveMessageReportItem.setEnabled(false);
    saveMessageReportItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    fileMenu.add(saveMessageReportItem);
    //        sendFilesWebDAV.setEnabled(false);
    //        fileMenu.add(sendFilesWebDAV);
    fileMenu.addSeparator();
    fileMenu.add(quitItem);

    optionMenu.add(countryCodeItem);
    optionMenu.add(repositoryCodeItem);
    optionMenu.add(digitalObjectTypeItem);
    optionMenu.add(edmGeneralOptionsItem);
    optionMenu.add(listDateConversionRulesItem);
    optionMenu.addSeparator();
    optionMenu.add(xsltItem);
    optionMenu.add(xsdItem);
    optionMenu.add(defaultXslSelectionSubmenu);
    optionMenu.add(defaultXsdSelectionSubmenu);
    optionMenu.addSeparator();
    optionMenu.add(checksLoadingFilesItem);
    optionMenu.add(defaultSaveFolderItem);
    optionMenu.add(languageMenu);
    if (Utilities.isDev) {
        optionMenu.addSeparator();
        optionMenu.add(databaseItem);
    }

    validateItem.setEnabled(false);
    validateItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    actionMenu.add(validateItem);
    convertItem.setEnabled(false);
    convertItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_M, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    actionMenu.add(convertItem);

    actionMenu.addSeparator();

    // TODO: Uncomment when edit will be available.
    //        eacCpfItem.add(this.editEacCpfFile);     //add the different EAC-CPF options menu
    eacCpfItem.add(createEacCpf);
    actionMenu.add(eacCpfItem);

    createEag2012Item.add(createEag2012FromExistingEag2012);
    createEag2012Item.add(createEag2012FromScratch);
    actionMenu.add(createEag2012Item);

    summaryWindowItem.setEnabled(true);
    summaryWindowItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_1, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    windowMenu.add(summaryWindowItem);
    validationWindowItem.setEnabled(true);
    validationWindowItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_2, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    windowMenu.add(validationWindowItem);
    conversionWindowItem.setEnabled(true);
    conversionWindowItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_3, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    windowMenu.add(conversionWindowItem);
    edmConversionWindowItem.setEnabled(true);
    edmConversionWindowItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_4, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    windowMenu.add(edmConversionWindowItem);
    editionWindowItem.setEnabled(true);
    editionWindowItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_5, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    windowMenu.add(editionWindowItem);
    helpMenu.add(internetApexItem);
    helpMenu.addSeparator();
    JMenuItem versionItem = new JMenuItem("APE DPT v" + VERSION_NB);
    versionItem.setEnabled(false);
    helpMenu.add(versionItem);
    createLanguageMenu();
    fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    fileChooser.setMultiSelectionEnabled(true);

    getContentPane().add(menuBar, BorderLayout.NORTH);

    apePanel.setFilename("");

    createHgListener = new CreateHGListener(retrieveFromDb, labels, getContentPane(), fileInstances, xmlEadList,
            this);
    createHGBtn.addActionListener(createHgListener);
    createHGBtn.setEnabled(false);

    analyzeControlaccessListener = new AnalyzeControlaccessListener(labels, getContentPane(), fileInstances);
    analyzeControlaccessBtn.addActionListener(analyzeControlaccessListener);
    analyzeControlaccessBtn.setEnabled(false);

    validateItem.addActionListener(new ConvertAndValidateActionListener(this, apePanel.getApeTabbedPane(),
            ConvertAndValidateActionListener.VALIDATE));
    convertItem.addActionListener(new ConvertAndValidateActionListener(this, apePanel.getApeTabbedPane(),
            ConvertAndValidateActionListener.CONVERT));

    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    getContentPane().add(createWest(), BorderLayout.WEST);

    //        convertAndValidateBtn.addActionListener(new ConvertAndValidateActionListener(this, getContentPane()));
    //        validateSelectionBtn.addActionListener(new ValidateSelectionActionListener(this, getContentPane()));
    //        convertEdmSelectionBtn.addActionListener(new ConvertEdmActionListener(labels, this, apePanel));

    nameComponents();
    wireUp();
    setSize(Toolkit.getDefaultToolkit().getScreenSize());
    setMinimumSize(Toolkit.getDefaultToolkit().getScreenSize());
    setExtendedState(JFrame.MAXIMIZED_BOTH);
}

From source file:org.photovault.swingui.PhotoCollectionThumbView.java

void createUI() {
    photoTransferHandler = new PhotoCollectionTransferHandler(this);
    setTransferHandler(photoTransferHandler);

    setAutoscrolls(true);/*from   w  w  w  . j a v  a2  s  .  c o  m*/

    addMouseListener(this);
    addMouseMotionListener(this);

    // Create the popup menu
    popup = new JPopupMenu();
    ImageIcon propsIcon = getIcon("view_properties.png");
    editSelectionPropsAction = new EditSelectionPropsAction(this, "Properties...", propsIcon,
            "Edit properties of the selected photos", KeyEvent.VK_P);
    JMenuItem propsItem = new JMenuItem(editSelectionPropsAction);
    ImageIcon colorsIcon = getIcon("colors.png");
    editSelectionColorsAction = new EditSelectionColorsAction(this, null, "Adjust colors...", colorsIcon,
            "Adjust colors of the selected photos", KeyEvent.VK_A);
    JMenuItem colorsItem = new JMenuItem(editSelectionColorsAction);
    ImageIcon showIcon = getIcon("show_new_window.png");
    showSelectedPhotoAction = new ShowSelectedPhotoAction(this, "Show image", showIcon,
            "Show the selected phot(s)", KeyEvent.VK_S);
    JMenuItem showItem = new JMenuItem(showSelectedPhotoAction);
    showHistoryAction = new ShowPhotoHistoryAction(this, "Show history", null, "Show history of selected photo",
            KeyEvent.VK_H, null);
    resolveConflictsAction = new ResolvePhotoConflictsAction(this, "Resolve conflicts", null,
            "Resolve synchronization conflicts", KeyEvent.VK_R, null);
    JMenuItem rotateCW = new JMenuItem(ctrl.getActionAdapter("rotate_cw"));
    JMenuItem rotateCCW = new JMenuItem(ctrl.getActionAdapter("rotate_ccw"));
    JMenuItem rotate180deg = new JMenuItem(ctrl.getActionAdapter("rotate_180"));

    JMenuItem addToFolder = new JMenuItem("Add to folder...");
    addToFolder.addActionListener(this);
    addToFolder.setActionCommand(PHOTO_ADD_TO_FOLDER_CMD);
    addToFolder.setIcon(getIcon("empty_icon.png"));
    ImageIcon exportIcon = getIcon("filesave.png");
    exportSelectedAction = new ExportSelectedAction(this, "Export selected...", exportIcon,
            "Export the selected photos to from archive database to image files", KeyEvent.VK_E);
    JMenuItem exportSelected = new JMenuItem(exportSelectedAction);

    ImageIcon deleteSelectedIcon = getIcon("delete_image.png");
    deleteSelectedAction = new DeletePhotoAction(this, "Delete", deleteSelectedIcon,
            "Delete selected photos including all of their instances", KeyEvent.VK_D);
    JMenuItem deleteSelected = new JMenuItem(deleteSelectedAction);

    starIcon = getIcon("star_normal_border.png");
    rejectedIcon = getIcon("quality_unusable.png");

    rawIcon = getIcon("raw_icon.png");

    JMenuItem showHistory = new JMenuItem(showHistoryAction);
    JMenuItem resolveConflicts = new JMenuItem(resolveConflictsAction);
    AddTagAction addTagAction = new AddTagAction(ctrl, "Add tag...", null, "Add tag to image", KeyEvent.VK_T);
    JMenuItem addTag = new JMenuItem(addTagAction);
    popup.add(showItem);
    popup.add(propsItem);
    popup.add(colorsItem);
    popup.add(rotateCW);
    popup.add(rotateCCW);
    popup.add(rotate180deg);
    popup.add(addToFolder);
    popup.add(exportSelected);
    popup.add(deleteSelected);
    popup.add(showHistory);
    popup.add(resolveConflicts);
    popup.add(addTag);
    MouseListener popupListener = new PopupListener();
    addMouseListener(popupListener);

    ImageIcon selectNextIcon = getIcon("next.png");
    selectNextAction = new ChangeSelectionAction(this, ChangeSelectionAction.MOVE_FWD, "Next photo",
            selectNextIcon, "Move to next photo", KeyEvent.VK_N,
            KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

    ImageIcon selectPrevIcon = getIcon("previous.png");
    selectPrevAction = new ChangeSelectionAction(this, ChangeSelectionAction.MOVE_BACK, "Previous photo",
            selectPrevIcon, "Move to previous photo", KeyEvent.VK_P,
            KeyStroke.getKeyStroke(KeyEvent.VK_P, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));

    creatingThumbIcon = getIcon("creating_thumb.png");
}

From source file:ch.fork.AdHocRailway.ui.AdHocRailway.java

private void initMenu() {
    menuBar = new JMenuBar();
    /* FILE *///ww w.j  a  v  a2 s . com
    final JMenu fileMenu = new JMenu("File");
    fileMenu.setMnemonic(KeyEvent.VK_F);

    final JMenuItem newItem = new JMenuItem(new NewFileAction());
    newItem.setMnemonic(KeyEvent.VK_N);
    newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));

    final JMenuItem openItem = new JMenuItem(new OpenFileAction());
    openItem.setMnemonic(KeyEvent.VK_O);
    openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));

    final JMenuItem openDatabaseItem = new JMenuItem(new OpenDatabaseAction());

    saveItem = new JMenuItem(new SaveAction());
    saveItem.setMnemonic(KeyEvent.VK_S);
    saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));

    saveAsItem = new JMenuItem(new SaveAsAction());
    saveAsItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK));

    final JMenuItem importAllItem = new JMenuItem(new ImportAllAction());
    final JMenuItem importLocomotivesItem = new JMenuItem(new ImportLocomotivesAction());
    final JMenuItem exportLocomotivesItem = new JMenuItem(new ExportLocomotivesAction());
    final JMenuItem exportAllItem = new JMenuItem(new ExportAllAction());

    final JMenu importMenu = new JMenu("Import");
    importMenu.add(importAllItem);
    importMenu.add(importLocomotivesItem);
    final JMenu exportMenu = new JMenu("Export");
    exportMenu.add(exportLocomotivesItem);
    exportMenu.add(exportAllItem);

    final JMenuItem clearLocomotivesItem = new JMenuItem(new ClearLocomotivesAction());
    final JMenuItem clearTurnoutsRoutesItem = new JMenuItem(new ClearTurnoutsAndRoutesAction());

    final JMenu clearMenu = new JMenu("Clear");
    clearMenu.add(clearLocomotivesItem);
    clearMenu.add(clearTurnoutsRoutesItem);

    final JMenuItem exitItem = new JMenuItem(new ExitAction());
    exitItem.setMnemonic(KeyEvent.VK_X);
    exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK));

    fileMenu.add(newItem);
    fileMenu.add(openItem);
    fileMenu.add(openDatabaseItem);
    fileMenu.add(saveItem);
    fileMenu.add(saveAsItem);
    fileMenu.add(new JSeparator());
    fileMenu.add(importMenu);
    fileMenu.add(exportMenu);
    fileMenu.add(clearMenu);
    fileMenu.add(new JSeparator());
    fileMenu.add(exitItem);

    /* EDIT */
    final JMenu editMenu = new JMenu("Edit");
    enableEditing = new JCheckBoxMenuItem(new EnableEditingAction());

    switchesItem = new JMenuItem(new TurnoutAction());
    routesItem = new JMenuItem(new RoutesAction());
    locomotivesItem = new JMenuItem(new LocomotivesAction());
    preferencesItem = new JMenuItem(new PreferencesAction());
    enableEditing.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.ALT_MASK));

    switchesItem.setMnemonic(KeyEvent.VK_T);
    switchesItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.ALT_MASK));
    routesItem.setMnemonic(KeyEvent.VK_R);
    routesItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.ALT_MASK));
    locomotivesItem.setMnemonic(KeyEvent.VK_L);
    locomotivesItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, ActionEvent.ALT_MASK));
    preferencesItem.setMnemonic(KeyEvent.VK_P);
    preferencesItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.ALT_MASK));
    editMenu.add(enableEditing);
    editMenu.add(new JSeparator());
    editMenu.add(switchesItem);
    editMenu.add(routesItem);
    editMenu.add(locomotivesItem);
    editMenu.add(new JSeparator());
    editMenu.add(preferencesItem);

    /* DAEMON */
    final JMenu daemonMenu = new JMenu("Device");
    daemonConnectItem = new JMenuItem(new ConnectAction());
    daemonConnectItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK));
    daemonDisconnectItem = new JMenuItem(new DisconnectAction());
    daemonPowerOnItem = new JMenuItem(new PowerOnAction());
    assignAccelerator(daemonPowerOnItem, "PowerOn");
    daemonPowerOnItem.setEnabled(true);
    daemonPowerOffItem = new JMenuItem(new PowerOffAction());
    assignAccelerator(daemonPowerOffItem, "PowerOff");
    daemonPowerOffItem.setEnabled(true);
    daemonDisconnectItem.setEnabled(false);
    daemonMenu.add(daemonConnectItem);
    daemonMenu.add(daemonDisconnectItem);
    daemonMenu.add(new JSeparator());
    daemonMenu.add(daemonPowerOnItem);
    daemonMenu.add(daemonPowerOffItem);

    /* VIEW */
    final JMenu viewMenu = new JMenu("View");
    final JMenuItem refreshItem = new JMenuItem(new RefreshAction());
    final JMenuItem fullscreenItem = new JMenuItem(new ToggleFullscreenAction());

    viewMenu.add(refreshItem);
    viewMenu.add(fullscreenItem);

    /* HELP */
    // JMenu helpMenu = new JMenu("Help");
    addMenu(fileMenu);
    addMenu(editMenu);
    addMenu(daemonMenu);
    addMenu(viewMenu);
    // addMenu(helpMenu);
    setJMenuBar(menuBar);
}

From source file:cz.muni.fi.javaseminar.kafa.bookregister.gui.MainWindow.java

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

    authorsPanel = new javax.swing.JPanel();
    authorsLabel = new javax.swing.JLabel();
    authorsScrollPane = new javax.swing.JScrollPane();
    authorsTable = new javax.swing.JTable();
    booksPanel = new javax.swing.JPanel();
    booksScrollPane = new javax.swing.JScrollPane();
    booksTable = new javax.swing.JTable();
    booksLabel = new javax.swing.JLabel();
    mainMenuBar = new javax.swing.JMenuBar();
    fileMenu = new javax.swing.JMenu();
    newAuthorMenuItem = new javax.swing.JMenuItem();
    newBookMenuItem = new javax.swing.JMenuItem();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Book Register 1.0");
    setMinimumSize(new java.awt.Dimension(1024, 480));
    setPreferredSize(new java.awt.Dimension(1024, 640));
    getContentPane().setLayout(new java.awt.GridLayout(2, 1));

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

    java.util.ResourceBundle bundle = java.util.ResourceBundle
            .getBundle("cz/muni/fi/javaseminar/kafa/bookregister/gui/Bundle"); // NOI18N
    authorsLabel.setText(bundle.getString("Table.authors.title")); // NOI18N
    authorsPanel.add(authorsLabel, java.awt.BorderLayout.PAGE_START);

    authorsTable.setModel(authorsTableModel);
    authorsTable.setMinimumSize(new java.awt.Dimension(480, 640));
    authorsScrollPane.setViewportView(authorsTable);

    authorsPanel.add(authorsScrollPane, java.awt.BorderLayout.CENTER);

    getContentPane().add(authorsPanel);

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

    booksTable.setModel(booksTableModel);
    booksScrollPane.setViewportView(booksTable);

    booksPanel.add(booksScrollPane, java.awt.BorderLayout.CENTER);

    booksLabel.setText(bundle.getString("Table.books.title")); // NOI18N
    booksPanel.add(booksLabel, java.awt.BorderLayout.PAGE_START);

    getContentPane().add(booksPanel);

    fileMenu.setText(bundle.getString("Menu.file")); // NOI18N

    newAuthorMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A,
            java.awt.event.InputEvent.CTRL_MASK));
    newAuthorMenuItem.setText(bundle.getString("Menu.file.newAuthor")); // NOI18N
    newAuthorMenuItem.setMnemonic(KeyEvent.VK_N);
    newAuthorMenuItem.setAction(spawnNewAuthorWindowAction);
    newAuthorMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.CTRL_DOWN_MASK));
    fileMenu.add(newAuthorMenuItem);

    newBookMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B,
            java.awt.event.InputEvent.CTRL_MASK));
    newBookMenuItem.setText(bundle.getString("Menu.file.newBook")); // NOI18N
    newBookMenuItem.setMnemonic(KeyEvent.VK_B);
    newBookMenuItem.setAction(spawnNewBookWindowAction);
    newBookMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, KeyEvent.CTRL_DOWN_MASK));

    newBookMenuItem.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            JMenuItem m = (JMenuItem) e.getSource();
            if (!m.isEnabled())
                JOptionPane.showMessageDialog(MainWindow.this, "You have to create an author first.");
        }
    });
    fileMenu.add(newBookMenuItem);

    fileMenu.setMnemonic(KeyEvent.VK_F);

    mainMenuBar.add(fileMenu);

    setJMenuBar(mainMenuBar);

    pack();
}

From source file:org.angnysa.yaba.swing.BudgetFrame.java

private void buildMenubar() {
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu(Messages.getString("menu.file.label")); //$NON-NLS-1$
    JMenuItem item;//w  w w.  j av a 2  s.  com

    // new
    item = new JMenuItem(Messages.getString("menu.file.new")); //$NON-NLS-1$
    item.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_N, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SwingMain.newEditor(null);
        }
    });
    fileMenu.add(item);

    // open
    item = new JMenuItem(Messages.getString("menu.file.open")); //$NON-NLS-1$
    item.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SwingMain.open(id);
        }
    });
    fileMenu.add(item);

    // save
    item = new JMenuItem(Messages.getString("menu.file.save")); //$NON-NLS-1$
    item.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SwingMain.save(id);
        }
    });
    fileMenu.add(item);

    // save as
    item = new JMenuItem(Messages.getString("menu.file.save-as")); //$NON-NLS-1$
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SwingMain.saveas(id);
        }
    });
    fileMenu.add(item);

    // close
    item = new JMenuItem(Messages.getString("menu.file.close")); //$NON-NLS-1$
    item.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_W, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            SwingMain.close(id);
        }
    });
    fileMenu.add(item);

    menuBar.add(fileMenu);
    setJMenuBar(menuBar);
}

From source file:burlov.ultracipher.swing.SwingGuiApplication.java

private JMenuBar createMenuBar() {
    JMenuBar bar = new JMenuBar();
    JMenu menu = null;//from  w  ww .  ja  v a 2  s .  c  o  m
    /*
     * 'File' Menue
     */
    menu = new JMenu("File");
    menu.setMnemonic(KeyEvent.VK_F);
    bar.add(menu);

    JMenuItem item = new JMenuItem("Save database");
    item.setAccelerator(KeyStroke.getKeyStroke("control S"));
    item.setMnemonic(KeyEvent.VK_S);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            saveDatabase();
        }
    });
    menu.add(item);

    item = new JMenuItem("Download database");
    item.setMnemonic(KeyEvent.VK_L);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            downloadAndMergeData();
        }
    });
    menu.add(item);

    item = new JMenuItem("Edit sync account");
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            editSyncAccount();
        }
    });
    menu.add(item);
    menu.add(new JSeparator());

    JMenu submenu = new JMenu("Import");
    menu.add(submenu);

    item = new JMenuItem("From CSV");
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            importCSV();
        }
    });
    submenu.add(item);

    submenu = new JMenu("Export");
    menu.add(submenu);

    item = new JMenuItem("As CSV");
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            exportCSV();
        }
    });
    submenu.add(item);
    item = new JMenuItem("Change passphrase");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            changePassword();
        }
    });

    /*
     * 'Edit' Menue
     */
    menu = new JMenu("Edit");
    menu.setMnemonic(KeyEvent.VK_E);
    bar.add(menu);
    item = menu.add(mainPanel.getNewEntryAction());
    item.setMnemonic(KeyEvent.VK_N);
    item = menu.add(mainPanel.getDeleteEntryAction());
    item.setMnemonic(KeyEvent.VK_D);

    menu.add(new JSeparator());

    menu = new JMenu("Tools");
    // item = new JMenuItem("Passwort generator");
    // menu.add(item);
    // item.addActionListener(new ActionListener() {
    //
    // @Override
    // public void actionPerformed(ActionEvent e) {
    // passGenerator.setVisible(false);
    // passGenerator.setLocationRelativeTo(getMainFrame());
    // passGenerator.setVisible(true);
    // }
    // });
    item = new JMenuItem("Screen keyboard");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            screenKeyboard.setLocationRelativeTo(getMainFrame());
            screenKeyboard.setVisible(true);

        }
    });
    item = new JMenuItem("File digester");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            digester.setLocationRelativeTo(getMainFrame());
            digester.setVisible(true);

        }
    });
    bar.add(menu);
    /*
     * 'Help' Menue
     */
    menu = new JMenu("Help");
    menu.setMnemonic(KeyEvent.VK_H);
    bar.add(menu);

    item = new JMenuItem("Performance test");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            measurePerformance();
        }
    });
    item = new JMenuItem("System info");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            showSystemInfo();
        }
    });
    item = new JMenuItem("About");
    menu.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            String text = "<html>Ultracipher 6.1<br>(C) Copyright 2015 Paul Burlov<br><br>"
                    + "Encryption strength: 768Bit (6 x 128Bit keys)<br>Cipher cascade: AES/Twofish/Serpent/CAST6/SEED/Camellia"
                    + "<br>Encryption mode: Two pass CBC"
                    + "<br>Key derivation algorithm: SCrypt with N=2^14,P=8,R=1<br><br> "
                    + "This product includes software developed by the<br>"
                    + "<ul><li>Apache Software Foundation "
                    + "<a href='http://www.apache.org'>http://www.apache.org</a>"
                    + "<li>Legion of the Bouncy Castle <a href='http://bouncycastle.org/'>http://bouncycastle.org</a>"
                    + "<li>Project SwingX" + "<li>Bytecode Pty Ltd." + "</ul></html>";
            JOptionPane.showMessageDialog(getMainFrame(), text, "", JOptionPane.INFORMATION_MESSAGE,
                    getAppIcon());
        }
    });
    bar.add(Box.createHorizontalGlue());
    menu = new JMenu("Keyboard");
    ButtonGroup group = new ButtonGroup();
    JRadioButtonMenuItem radioitem = new JRadioButtonMenuItem("System");
    radioitem.setSelected(true);
    group.add(radioitem);
    radioitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            translator.resetMapping();
        }
    });
    menu.add(radioitem);
    radioitem = new JRadioButtonMenuItem("Futhark runes");
    group.add(radioitem);
    radioitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            translator.initForFuthark();
        }
    });
    menu.add(radioitem);
    radioitem = new JRadioButtonMenuItem("Anglo-Saxon runes");
    group.add(radioitem);
    radioitem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            translator.initForAngloSaxon();
        }
    });
    menu.add(radioitem);
    bar.add(menu);
    // bar.add(Box.createHorizontalGlue());
    // bar.add(new PassGeneratorPanel());
    return bar;
}

From source file:xtrememp.XtremeMP.java

protected void createMenuBar() {
    menuBar = new JMenuBar();

    // File Menu//  w  w  w.  j  a  va  2s.  c o m
    String fileMenuStr = tr("MainFrame.Menu.File");
    fileMenu = new JMenu(fileMenuStr);
    fileMenu.setMnemonic(fileMenuStr.charAt(0));

    openMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenFile"));
    openMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK));
    openMenuItem.setIcon(Utilities.FOLDER_ICON);
    openMenuItem.addActionListener(this);
    fileMenu.add(openMenuItem);

    openURLMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenURL"));
    openURLMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_DOWN_MASK));
    openURLMenuItem.setIcon(Utilities.FOLDER_REMOTE_ICON);
    openURLMenuItem.addActionListener(this);
    fileMenu.add(openURLMenuItem);

    fileMenu.addSeparator();

    openPlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.File.OpenPlaylist"));
    openPlaylistMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));
    openPlaylistMenuItem.setIcon(Utilities.DOCUMENT_OPEN_ICON);
    openPlaylistMenuItem.addActionListener(this);
    fileMenu.add(openPlaylistMenuItem);

    savePlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.File.SavePlaylist"));
    savePlaylistMenuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));
    savePlaylistMenuItem.setIcon(Utilities.DOCUMENT_SAVE_ICON);
    savePlaylistMenuItem.addActionListener(this);
    fileMenu.add(savePlaylistMenuItem);

    fileMenu.addSeparator();

    preferencesMenuItem = new JMenuItem(tr("MainFrame.Menu.File.Preferences"));
    preferencesMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_DOWN_MASK));
    preferencesMenuItem.addActionListener(this);
    fileMenu.add(preferencesMenuItem);

    fileMenu.addSeparator();

    exitMenuItem = new JMenuItem(tr("MainFrame.Menu.File.Exit"));
    exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK));
    exitMenuItem.addActionListener(this);
    fileMenu.add(exitMenuItem);

    menuBar.add(fileMenu);

    // Player Menu
    String playerMenuStr = tr("MainFrame.Menu.Player");
    playerMenu = new JMenu(playerMenuStr);
    playerMenu.setMnemonic(playerMenuStr.charAt(0));

    playPauseMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Play"));
    playPauseMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK));
    playPauseMenuItem.addActionListener(this);
    playerMenu.add(playPauseMenuItem);

    stopMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Stop"));
    stopMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.CTRL_DOWN_MASK));
    //        stopMenuItem.setIcon(Utilities.MEDIA_STOP_ICON);
    stopMenuItem.setEnabled(false);
    stopMenuItem.addActionListener(this);
    playerMenu.add(stopMenuItem);

    previousMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Previous"));
    previousMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK));
    //        previousMenuItem.setIcon(Utilities.MEDIA_PREVIOUS_ICON);
    previousMenuItem.setEnabled(false);
    previousMenuItem.addActionListener(this);
    playerMenu.add(previousMenuItem);

    nextMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Next"));
    nextMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_DOWN_MASK));
    //        nextMenuItem.setIcon(Utilities.MEDIA_NEXT_ICON);
    nextMenuItem.setEnabled(false);
    nextMenuItem.addActionListener(this);
    playerMenu.add(nextMenuItem);

    playerMenu.addSeparator();

    //PlayMode submenu
    String playModeSubMenuStr = tr("MainFrame.Menu.Player.PlayMode");
    playModeSubMenu = new JMenu(playModeSubMenuStr);

    playModeRepeatNoneMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatNone"));
    playModeRepeatNoneMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_NONE_ICON);
    playModeRepeatNoneMenuItem.addActionListener(this);
    playModeSubMenu.add(playModeRepeatNoneMenuItem);
    playModeRepeatOneMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatOne"));
    playModeRepeatOneMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_ONE_ICON);
    playModeRepeatOneMenuItem.addActionListener(this);
    playModeSubMenu.add(playModeRepeatOneMenuItem);
    playModeRepeatAllMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.RepeatAll"));
    playModeRepeatAllMenuItem.setIcon(Utilities.PLAYLIST_REPEAT_ALL_ICON);
    playModeRepeatAllMenuItem.addActionListener(this);
    playModeSubMenu.add(playModeRepeatAllMenuItem);
    playModeShuffleMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.Player.PlayMode.Shuffle"));
    playModeShuffleMenuItem.setIcon(Utilities.PLAYLIST_SHUFFLE_ICON);
    playModeShuffleMenuItem.addActionListener(this);
    playModeSubMenu.add(playModeShuffleMenuItem);

    ButtonGroup playModeBG = new ButtonGroup();
    playModeBG.add(playModeRepeatNoneMenuItem);
    playModeBG.add(playModeRepeatOneMenuItem);
    playModeBG.add(playModeRepeatAllMenuItem);
    playModeBG.add(playModeShuffleMenuItem);

    playerMenu.add(playModeSubMenu);
    playerMenu.addSeparator();

    randomizePlaylistMenuItem = new JMenuItem(tr("MainFrame.Menu.Player.Randomize"));
    randomizePlaylistMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_DOWN_MASK));
    randomizePlaylistMenuItem.setEnabled(false);
    randomizePlaylistMenuItem.addActionListener(this);
    playerMenu.add(randomizePlaylistMenuItem);

    menuBar.add(playerMenu);

    // View Menu
    String viewMenuStr = tr("MainFrame.Menu.View");
    viewMenu = new JMenu(viewMenuStr);
    viewMenu.setMnemonic(viewMenuStr.charAt(0));

    playlistManagerMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.View.PlaylistManager"));
    playlistManagerMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK));
    playlistManagerMenuItem.addActionListener(this);
    viewMenu.add(playlistManagerMenuItem);

    visualizationMenuItem = new JRadioButtonMenuItem(tr("MainFrame.Menu.View.Visualizations"));
    visualizationMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.CTRL_DOWN_MASK));
    visualizationMenuItem.addActionListener(this);
    viewMenu.add(visualizationMenuItem);

    ButtonGroup viewBG = new ButtonGroup();
    viewBG.add(playlistManagerMenuItem);
    viewBG.add(visualizationMenuItem);

    menuBar.add(viewMenu);

    // Help menu
    String helpMenuStr = tr("MainFrame.Menu.Help");
    helpMenu = new JMenu(helpMenuStr);
    helpMenu.setMnemonic(helpMenuStr.charAt(0));

    updateMenuItem = new JMenuItem(tr("MainFrame.Menu.Help.CheckForUpdates"));
    updateMenuItem.addActionListener(this);
    helpMenu.add(updateMenuItem);
    helpMenu.addSeparator();

    aboutMenuItem = new JMenuItem(tr("MainFrame.Menu.Help.About"));
    aboutMenuItem.addActionListener(this);
    helpMenu.add(aboutMenuItem);

    menuBar.add(helpMenu);

    menuBar.add(Box.createHorizontalGlue());
    busyLabel = new BusyLabel(new Dimension(20, 20));
    menuBar.add(busyLabel);
    menuBar.add(Box.createHorizontalStrut(8));

    mainFrame.setJMenuBar(menuBar);
}

From source file:com.freedomotic.jfrontend.MainWindow.java

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

    jTextField1 = new javax.swing.JTextField();
    scrollTxtOut1 = new javax.swing.JScrollPane();
    txtOut1 = new javax.swing.JTextArea();
    scrollTxtOut2 = new javax.swing.JScrollPane();
    txtOut2 = new javax.swing.JTextArea();
    jMenuItem4 = new javax.swing.JMenuItem();
    jSeparator2 = new javax.swing.JSeparator();
    menuBar = new javax.swing.JMenuBar();
    mnuOpenNew = new javax.swing.JMenu();
    mnuNewEnvironment = new javax.swing.JMenuItem();
    mnuOpenEnvironment = new javax.swing.JMenuItem();
    mnuSave = new javax.swing.JMenuItem();
    mnuSaveAs = new javax.swing.JMenuItem();
    jSeparator1 = new javax.swing.JSeparator();
    mnuSwitchUser = new javax.swing.JMenuItem();
    mnuExit = new javax.swing.JMenuItem();
    mnuEditMode = new javax.swing.JMenu();
    mnuSelectEnvironment = new javax.swing.JMenuItem();
    jMenu4 = new javax.swing.JMenu();
    mnuRenameEnvironment = new javax.swing.JMenuItem();
    mnuAddDuplicateEnvironment = new javax.swing.JMenuItem();
    mnuChangeRenderer = new javax.swing.JMenuItem();
    mnuBackground = new javax.swing.JMenuItem();
    mnuDelete = new javax.swing.JMenuItem();
    mnuRoomEditMode = new javax.swing.JCheckBoxMenuItem();
    jMenu3 = new javax.swing.JMenu();
    mnuRenameRoom = new javax.swing.JMenuItem();
    mnuAddRoom = new javax.swing.JMenuItem();
    mnuRoomBackground = new javax.swing.JMenuItem();
    mnuRemoveRoom = new javax.swing.JMenuItem();
    mnuObjects = new javax.swing.JMenu();
    mnuObjectEditMode = new javax.swing.JCheckBoxMenuItem();
    jMenu2 = new javax.swing.JMenu();
    mnuAutomations = new javax.swing.JMenuItem();
    jMenu1 = new javax.swing.JMenu();
    jCheckBoxMarket = new javax.swing.JCheckBoxMenuItem();
    mnuPluginConfigure = new javax.swing.JMenuItem();
    jMenu5 = new javax.swing.JMenu();
    mnuLanguage = new javax.swing.JMenuItem();
    mnuPrivileges = new javax.swing.JMenuItem();
    mnuWindow = new javax.swing.JMenu();
    mnuPluginList = new javax.swing.JMenuItem();
    jMenuItem3 = new javax.swing.JMenuItem();
    mnuHelp = new javax.swing.JMenu();
    mnuTutorial = new javax.swing.JMenuItem();
    jMenuItem1 = new javax.swing.JMenuItem();
    submnuHelp = new javax.swing.JMenuItem();

    jTextField1.setText("jTextField1");

    scrollTxtOut1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    txtOut1.setEditable(false);
    txtOut1.setColumns(20);
    txtOut1.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
    txtOut1.setRows(5);
    txtOut1.setWrapStyleWord(true);
    txtOut1.setName("txtOutput"); // NOI18N
    txtOut1.setOpaque(false);
    scrollTxtOut1.setViewportView(txtOut1);

    scrollTxtOut2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    txtOut2.setEditable(false);
    txtOut2.setColumns(20);
    txtOut2.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
    txtOut2.setRows(5);
    txtOut2.setWrapStyleWord(true);
    txtOut2.setName("txtOutput"); // NOI18N
    txtOut2.setOpaque(false);
    scrollTxtOut2.setViewportView(txtOut2);

    jMenuItem4.setText("jMenuItem4");

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Freedomotic");
    setBackground(java.awt.SystemColor.window);
    setBounds(new java.awt.Rectangle(50, 20, 0, 0));
    setLocationByPlatform(true);
    setMinimumSize(new java.awt.Dimension(500, 400));
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }

        public void windowClosed(java.awt.event.WindowEvent evt) {
            formWindowClosed(evt);
        }

        public void windowActivated(java.awt.event.WindowEvent evt) {
            drawer.repaint();
        }
    });
    addComponentListener(new java.awt.event.ComponentAdapter() {
        public void componentResized(java.awt.event.ComponentEvent evt) {
            formComponentResized(evt);
        }
    });
    addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
        public void mouseMoved(java.awt.event.MouseEvent evt) {
            formMouseMoved(evt);
        }
    });

    mnuOpenNew.setText(i18n.msg("file"));
    mnuOpenNew.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuOpenNewActionPerformed(evt);
        }
    });

    mnuNewEnvironment.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N,
            java.awt.event.InputEvent.CTRL_MASK));
    mnuNewEnvironment.setText(i18n.msg("new") + i18n.msg("environment"));
    mnuNewEnvironment.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuNewEnvironmentActionPerformed(evt);
        }
    });
    mnuOpenNew.add(mnuNewEnvironment);

    mnuOpenEnvironment.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O,
            java.awt.event.InputEvent.CTRL_MASK));
    mnuOpenEnvironment.setText(i18n.msg("open") + i18n.msg("environment"));
    mnuOpenEnvironment.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuOpenEnvironmentActionPerformed(evt);
        }
    });
    mnuOpenNew.add(mnuOpenEnvironment);

    mnuSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            java.awt.event.InputEvent.CTRL_MASK));
    mnuSave.setText(i18n.msg("save") + i18n.msg("environment"));
    mnuSave.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuSaveActionPerformed(evt);
        }
    });
    mnuOpenNew.add(mnuSave);

    mnuSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S,
            java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
    mnuSaveAs.setText(i18n.msg("save_X_as", new Object[] { i18n.msg("environment") }));
    mnuSaveAs.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuSaveAsActionPerformed(evt);
        }
    });
    mnuOpenNew.add(mnuSaveAs);
    mnuOpenNew.add(jSeparator1);

    mnuSwitchUser.setText(i18n.msg("change_user"));
    mnuSwitchUser.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuSwitchUserActionPerformed(evt);
        }
    });
    mnuOpenNew.add(mnuSwitchUser);

    mnuExit.setText(i18n.msg("exit"));
    mnuExit.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuExitActionPerformed(evt);
        }
    });
    mnuOpenNew.add(mnuExit);

    menuBar.add(mnuOpenNew);

    mnuEditMode.setText(i18n.msg("environment"));

    mnuSelectEnvironment.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F3, 0));
    mnuSelectEnvironment.setText(i18n.msg("select_X", new Object[] { i18n.msg("area_floor") }));
    mnuSelectEnvironment.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuSelectEnvironmentActionPerformed(evt);
        }
    });
    mnuEditMode.add(mnuSelectEnvironment);

    jMenu4.setText(i18n.msg("area_floor"));

    mnuRenameEnvironment.setText(i18n.msg("rename"));
    mnuRenameEnvironment.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuRenameEnvironmentActionPerformed(evt);
        }
    });
    jMenu4.add(mnuRenameEnvironment);

    mnuAddDuplicateEnvironment.setText(i18n.msg("add") + "/" + i18n.msg("duplicate"));
    mnuAddDuplicateEnvironment.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuAddDuplicateEnvironmentActionPerformed(evt);
        }
    });
    jMenu4.add(mnuAddDuplicateEnvironment);

    mnuChangeRenderer.setText(i18n.msg("change_X", new Object[] { i18n.msg("renderer") }));
    mnuChangeRenderer.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuChangeRendererActionPerformed(evt);
        }
    });
    jMenu4.add(mnuChangeRenderer);

    mnuBackground.setText(i18n.msg("change_X", new Object[] { i18n.msg("background") }));
    mnuBackground.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuBackgroundActionPerformed(evt);
        }
    });
    jMenu4.add(mnuBackground);

    mnuDelete.setText(i18n.msg("delete"));
    mnuDelete.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuDeleteActionPerformed(evt);
        }
    });
    jMenu4.add(mnuDelete);

    mnuEditMode.add(jMenu4);

    mnuRoomEditMode.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
    mnuRoomEditMode.setText(i18n.msg("X_edit_mode", new Object[] { i18n.msg("rooms") }));
    mnuRoomEditMode.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuRoomEditModeActionPerformed(evt);
        }
    });
    mnuEditMode.add(mnuRoomEditMode);

    jMenu3.setText(i18n.msg("rooms"));

    mnuRenameRoom.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R,
            java.awt.event.InputEvent.CTRL_MASK));
    mnuRenameRoom.setText(i18n.msg("rename") + i18n.msg("room"));
    mnuRenameRoom.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuRenameRoomActionPerformed(evt);
        }
    });
    jMenu3.add(mnuRenameRoom);

    mnuAddRoom.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A,
            java.awt.event.InputEvent.CTRL_MASK));
    mnuAddRoom.setText(i18n.msg("add") + i18n.msg("room"));
    mnuAddRoom.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuAddRoomActionPerformed(evt);
        }
    });
    jMenu3.add(mnuAddRoom);

    mnuRoomBackground.setText(i18n.msg("change_X", new Object[] { i18n.msg("background") }));
    mnuRoomBackground.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuRoomBackgroundActionPerformed(evt);
        }
    });
    jMenu3.add(mnuRoomBackground);

    mnuRemoveRoom.setText(i18n.msg("remove") + i18n.msg("room"));
    mnuRemoveRoom.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuRemoveRoomActionPerformed(evt);
        }
    });
    jMenu3.add(mnuRemoveRoom);

    mnuEditMode.add(jMenu3);

    menuBar.add(mnuEditMode);

    mnuObjects.setText(i18n.msg("objects"));

    mnuObjectEditMode.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F6, 0));
    mnuObjectEditMode.setText(i18n.msg("X_edit_mode", new Object[] { i18n.msg("objects") }));
    mnuObjectEditMode.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuObjectEditModeActionPerformed(evt);
        }
    });
    mnuObjects.add(mnuObjectEditMode);

    menuBar.add(mnuObjects);

    jMenu2.setText(i18n.msg("automations"));

    mnuAutomations.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F7, 0));
    mnuAutomations.setText(i18n.msg("manage") + i18n.msg("automations"));
    mnuAutomations.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuAutomationsActionPerformed(evt);
        }
    });
    jMenu2.add(mnuAutomations);

    menuBar.add(jMenu2);

    jMenu1.setText(i18n.msg("plugins"));

    jCheckBoxMarket.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F8, 0));
    jCheckBoxMarket.setText(i18n.msg("install_from_marketplace"));
    jCheckBoxMarket.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jCheckBoxMarketActionPerformed(evt);
        }
    });
    jMenu1.add(jCheckBoxMarket);

    mnuPluginConfigure.setText(i18n.msg("configure"));
    mnuPluginConfigure.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuPluginConfigureActionPerformed(evt);
        }
    });
    jMenu1.add(mnuPluginConfigure);

    menuBar.add(jMenu1);

    jMenu5.setText(i18n.msg("settings"));

    mnuLanguage.setText(i18n.msg("language"));
    mnuLanguage.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuLanguageActionPerformed(evt);
        }
    });
    jMenu5.add(mnuLanguage);

    mnuPrivileges.setText(i18n.msg("privileges"));
    mnuPrivileges.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuPrivilegesActionPerformed(evt);
        }
    });
    jMenu5.add(mnuPrivileges);

    menuBar.add(jMenu5);

    mnuWindow.setText(i18n.msg("window"));

    mnuPluginList.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F9, 0));
    mnuPluginList.setText(i18n.msg("X_list", new Object[] { i18n.msg("plugins") }));
    mnuPluginList.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuPluginListActionPerformed(evt);
        }
    });
    mnuWindow.add(mnuPluginList);

    jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F11, 0));
    jMenuItem3.setText(i18n.msg("fullscreen"));
    jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem3ActionPerformed(evt);
        }
    });
    mnuWindow.add(jMenuItem3);

    menuBar.add(mnuWindow);

    mnuHelp.setText(i18n.msg("help"));

    mnuTutorial.setText(i18n.msg("tutorial"));
    mnuTutorial.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuTutorialActionPerformed(evt);
        }
    });
    mnuHelp.add(mnuTutorial);

    jMenuItem1.setText(master.getApi().getI18n().msg("report_issue"));
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItem1ActionPerformed(evt);
        }
    });
    mnuHelp.add(jMenuItem1);

    submnuHelp.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
    submnuHelp.setText(i18n.msg("about"));
    submnuHelp.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            submnuHelpActionPerformed(evt);
        }
    });
    mnuHelp.add(submnuHelp);

    menuBar.add(mnuHelp);

    setJMenuBar(menuBar);

    pack();
}