Example usage for javax.swing JMenu JMenu

List of usage examples for javax.swing JMenu JMenu

Introduction

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

Prototype

public JMenu(Action a) 

Source Link

Document

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

Usage

From source file:fi.smaa.jsmaa.gui.SMAATRIGUIFactory.java

@Override
protected JMenu buildResultsMenu() {
    JMenu resultsMenu = new JMenu("Results");
    resultsMenu.setMnemonic('r');
    JMenuItem racsItem = new JMenuItem("Category acceptability indices",
            ImageFactory.IMAGELOADER.getIcon(FileNames.ICON_RANKACCEPTABILITIES));
    racsItem.setMnemonic('r');

    racsItem.addActionListener(new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            Focuser.focus(tree, treeModel, treeModel.getCatAccNode());
        }/*from  w  w w . ja  va2s.co  m*/
    });

    resultsMenu.add(racsItem);
    return resultsMenu;
}

From source file:net.chaosserver.timelord.swingui.TimelordMenu.java

/**
 * Creates the view menu./*from w w  w  . jav a2 s . c om*/
 *
 * @return the new view menu
 */
protected JMenu createViewMenu() {
    JMenuItem menuItem;
    JMenu viewMenu = new JMenu("View");
    viewMenu.setMnemonic(KeyEvent.VK_V);

    JMenu annoyanceModeMenu = new JMenu("Annoyance Mode");
    annoyanceJordanCheckbox = new JCheckBoxMenuItem("Jordan Mode");
    annoyanceJordanCheckbox.setToolTipText("For Cool People");
    annoyanceJordanCheckbox.setActionCommand(ACTION_ANNOY_JORDAN);
    annoyanceJordanCheckbox.addActionListener(this);
    annoyanceModeMenu.add(annoyanceJordanCheckbox);

    annoyanceDougCheckbox = new JCheckBoxMenuItem("Doug Mode");
    annoyanceDougCheckbox.setToolTipText("For Losers");
    annoyanceJordanCheckbox.setActionCommand(ACTION_ANNOY_DOUG);
    annoyanceDougCheckbox.addActionListener(this);
    annoyanceModeMenu.add(annoyanceDougCheckbox);

    annoyanceNoneCheckbox = new JCheckBoxMenuItem("None");
    annoyanceJordanCheckbox.setActionCommand(ACTION_ANNOY_NONE);
    annoyanceNoneCheckbox.addActionListener(this);
    annoyanceModeMenu.add(annoyanceNoneCheckbox);
    updateAnnoyanceButtons();

    viewMenu.add(annoyanceModeMenu);

    menuItem = new JMenuItem("Refresh View", KeyEvent.VK_R);
    menuItem.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    menuItem.setActionCommand(ACTION_REFRESH_VIEW);
    menuItem.addActionListener(this);
    viewMenu.add(menuItem);

    viewMenu.addSeparator();

    menuItem = new JMenuItem("Change Start Time");
    menuItem.setActionCommand(ACTION_CHANGE_START);
    menuItem.addActionListener(this);
    viewMenu.add(menuItem);

    menuItem = new JMenuItem("Change Annoy Time");
    // currently disabled experimental functionality
    menuItem.setEnabled(false);
    menuItem.setActionCommand(ACTION_CHANGE_ANNOY);
    menuItem.addActionListener(this);
    viewMenu.add(menuItem);

    viewMenu.addSeparator();

    menuItem = new JMenuItem("Select Previous Tab", KeyEvent.VK_BRACELEFT);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BRACELEFT,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    menuItem.setActionCommand(ACTION_PREVIOUS_TAB);
    menuItem.addActionListener(this);
    viewMenu.add(menuItem);

    menuItem = new JMenuItem("Select Next Tab", KeyEvent.VK_BRACERIGHT);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_BRACERIGHT,
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    menuItem.setActionCommand(ACTION_NEXT_TAB);
    menuItem.addActionListener(this);
    viewMenu.add(menuItem);

    return viewMenu;
}

From source file:org.fhcrc.cpl.viewer.gui.MRMDialog.java

private void menuBarInitializations() {
    menuBarMain = new JMenuBar();
    this.setJMenuBar(menuBarMain);
    menuFile = new JMenu("File");
    menuBarMain.add(menuFile);/* w  w w. j  a  va2s.  c  om*/
    menuItemOpen = new JMenuItem("Open mzXML");
    menuFile.add(menuItemOpen);
    menuItemSaveImage = new JMenuItem("Save Chromatogram");
    menuItemQuit = new JMenuItem("Quit");
    menuItemLoadTSV = new JMenuItem("Load TSV table");
    menuFile.add(menuItemLoadTSV);
    menuFile.add(menuItemSaveImage);
    menuFile.add(menuItemQuit);
    menuOptions = new JMenu("Options");
    menuItemSICtolerance = new JMenuItem("SIC Tolerance");
    menuOptions.add(menuItemSICtolerance);
    menuItemPrecDiscTol = new JMenuItem("Precursor Tolerance");
    menuOptions.add(menuItemPrecDiscTol);
    menuItemDaughterDiscTol = new JMenuItem("Product Tolerance");
    menuOptions.add(menuItemDaughterDiscTol);
    menuItemTraceAllFragments = new JMenuItem("Trace Chromats");
    menuOptions.add(menuItemTraceAllFragments);
    menuItemChangeStrategy = new JMenuItem("Curve Strategy");
    menuOptions.add(menuItemChangeStrategy);
    menuItemSyncLH = new JMenuItem("Synchronize L/H label elution regions");
    menuOptions.add(menuItemSyncLH);
    menuItemPMin = new JMenuItem("Refilter Min Peak Height");
    menuOptions.add(menuItemPMin);
    menuItemAMin = new JMenuItem("Refilter Min Curve Area");
    menuOptions.add(menuItemAMin);
    menuBarMain.add(menuOptions);
    menuHelp = new JMenu("Help");
    menuItemArguments = new JMenuItem("Java commandline options");
    menuItemOptions = new JMenuItem("Options help");
    menuHelp.add(menuItemOptions);
    menuItemDefinitions = new JMenuItem("Definitions");
    menuHelp.add(menuItemDefinitions);
    menuItemTips = new JMenuItem("User Tips");
    menuHelp.add(menuItemTips);
    menuHelp.add(menuItemArguments);
    menuBarMain.add(menuHelp);
}

From source file:org.fhaes.fhsamplesize.view.FHSampleSize.java

/**
 * Set up the Menu bar using actions wherever possible.
 */// ww  w  .j  ava2 s  .co m
private void initMenu() {

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

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

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

    JMenu mnSave = new JMenu("Save...");
    mnFile.add(mnSave);

    JMenuItem mntmSaveTable = new JMenuItem(this.actionSaveTable);
    mnSave.add(mntmSaveTable);

    JMenuItem mntmSaveChartPDF = new JMenuItem(this.actionExportPDF);
    mnSave.add(mntmSaveChartPDF);

    JMenuItem mntmSaveChartPNG = new JMenuItem(this.actionExportPNG);
    mnSave.add(mntmSaveChartPNG);

    mnFile.addSeparator();

    JMenuItem mntmExit = new JMenuItem(this.actionClose);
    mnFile.add(mntmExit);
}

From source file:coolmap.application.widget.impl.WidgetUserGroup.java

private void initPopup() {
    JPopupMenu popup = new JPopupMenu();
    table.setComponentPopupMenu(popup);/*from   ww  w  .  j  ava2  s . c om*/

    JMenuItem item = new JMenuItem("Rename");
    popup.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            List<String> groupNames = getSelectedGroups();
            if (groupNames.isEmpty()) {
                return;
            }

            String returnVal = JOptionPane.showInputDialog(CoolMapMaster.getCMainFrame(),
                    "Please provide a new name:");
            if (returnVal == null || returnVal.length() == 0) {
                returnVal = "Untitled";
            }

            int counter = 0;
            String newName;
            for (String groupName : groupNames) {
                if (counter == 0) {
                    newName = returnVal;
                } else {
                    newName = returnVal + "_" + counter;
                }

                //new name must not exist
                int subCounter = 0;
                String name = newName;
                while (nodeGroups.containsKey(name)) {
                    subCounter++;
                    name = newName + "_" + subCounter;
                }
                newName = name;

                Color c = nodeColor.get(groupName);
                Set<VNode> nodes = new HashSet(nodeGroups.get(groupName));

                nodeColor.remove(groupName);
                nodeGroups.removeAll(groupName);

                nodeColor.put(newName, c);
                nodeGroups.putAll(newName, nodes);

                //                    System.out.println(newName + " " + c + " " + nodes);
                counter++;
            }

            updateTable();

        }
    });
    ////////////////////////////////////////////////////////////////////////

    //remove operations
    item = new JMenuItem("Remove");
    popup.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            List<String> groupNames = getSelectedGroups();
            for (String group : groupNames) {
                nodeColor.remove(group);
                nodeGroups.removeAll(group);
            }
            updateTable();
        }
    });

    //add separarator
    popup.addSeparator();
    JMenu insertRow = new JMenu("Add selected to row");
    popup.add(insertRow);

    JMenu insertColumn = new JMenu("Add selected to column");
    popup.add(insertColumn);

    item = new JMenuItem("prepend", UI.getImageIcon("prependRow"));
    insertRow.add(item);
    item.addActionListener(new ActionListener() {

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

    item = new JMenuItem("prepend", UI.getImageIcon("prependColumn"));
    insertColumn.add(item);
    item.addActionListener(new ActionListener() {

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

    item = new JMenuItem("insert", UI.getImageIcon("insertRow"));
    item.setToolTipText("Insert selected groups to the selected region in the active coolmap view");
    insertRow.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            CoolMapObject obj = CoolMapMaster.getActiveCoolMapObject();
            if (obj == null) {
                return;
            }

            int index = 0;
            ArrayList selectedRows = obj.getCoolMapView().getSelectedRows();
            if (!selectedRows.isEmpty()) {
                index = ((Range<Integer>) selectedRows.iterator().next()).lowerEndpoint();
            }
            insertRow(index);
        }
    });

    item = new JMenuItem("insert", UI.getImageIcon("insertColumn"));
    item.setToolTipText("Insert selected groups to the selected region in the active coolmap view");
    insertColumn.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {

            CoolMapObject obj = CoolMapMaster.getActiveCoolMapObject();
            if (obj == null) {
                return;
            }

            int index = 0;
            ArrayList selectedColumns = obj.getCoolMapView().getSelectedColumns();
            if (!selectedColumns.isEmpty()) {
                index = ((Range<Integer>) selectedColumns.iterator().next()).lowerEndpoint();
            }
            insertColumn(index);
        }
    });

    item = new JMenuItem("append", UI.getImageIcon("appendRow"));
    insertRow.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (CoolMapMaster.getActiveCoolMapObject() == null) {
                return;
            }
            insertRow(CoolMapMaster.getActiveCoolMapObject().getViewNumRows());
        }
    });

    item = new JMenuItem("append", UI.getImageIcon("appendColumn"));
    insertColumn.add(item);
    item.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (CoolMapMaster.getActiveCoolMapObject() == null) {
                return;
            }
            insertColumn(CoolMapMaster.getActiveCoolMapObject().getViewNumColumns());
        }
    });

    item = new JMenuItem("replace", UI.getImageIcon("replaceRow"));
    insertRow.add(item);
    item.addActionListener(new ActionListener() {

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

    item = new JMenuItem("replace", UI.getImageIcon("replaceColumn"));
    insertColumn.add(item);
    item.addActionListener(new ActionListener() {

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

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

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

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

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

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

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

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

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

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

From source file:com.haskins.cloudtrailviewer.sidebar.EventsChart.java

private JMenu getUserIdentityMenu(ButtonGroup buttonGroup) {

    JRadioButtonMenuItem mnuUiType = new JRadioButtonMenuItem("Type");
    JRadioButtonMenuItem mnuUiPrincipalId = new JRadioButtonMenuItem("Principal Id");
    JRadioButtonMenuItem mnuUiArn = new JRadioButtonMenuItem("Arn");
    JRadioButtonMenuItem mnuUiAccountId = new JRadioButtonMenuItem("Account Id");
    JRadioButtonMenuItem mnuUiAccessKeyId = new JRadioButtonMenuItem("Access Key Id");
    JRadioButtonMenuItem mnuUiUsername = new JRadioButtonMenuItem("Username");
    JRadioButtonMenuItem mnuUiInvokedBy = new JRadioButtonMenuItem("Invoked By");

    mnuUiType.setActionCommand("UserIdentity.Type");
    mnuUiType.addActionListener(this);

    mnuUiPrincipalId.setActionCommand("UserIdentity.PrincipalId");
    mnuUiPrincipalId.addActionListener(this);

    mnuUiArn.setActionCommand("UserIdentity.Arn");
    mnuUiArn.addActionListener(this);

    mnuUiAccountId.setActionCommand("UserIdentity.AccountId");
    mnuUiAccountId.addActionListener(this);

    mnuUiAccessKeyId.setActionCommand("UserIdentity.AccessKeyId");
    mnuUiAccessKeyId.addActionListener(this);

    mnuUiUsername.setActionCommand("UserIdentity.UserName");
    mnuUiUsername.addActionListener(this);

    mnuUiInvokedBy.setActionCommand("UserIdentity.InvokedBy");
    mnuUiInvokedBy.addActionListener(this);

    buttonGroup.add(mnuUiType);//from w w  w  . j  ava  2 s  . co  m
    buttonGroup.add(mnuUiPrincipalId);
    buttonGroup.add(mnuUiArn);
    buttonGroup.add(mnuUiAccountId);
    buttonGroup.add(mnuUiAccessKeyId);
    buttonGroup.add(mnuUiUsername);
    buttonGroup.add(mnuUiInvokedBy);

    JMenu userIdentityMenu = new JMenu("User Identity");
    userIdentityMenu.add(mnuUiType);
    userIdentityMenu.add(mnuUiPrincipalId);
    userIdentityMenu.add(mnuUiArn);
    userIdentityMenu.add(mnuUiAccountId);
    userIdentityMenu.add(mnuUiAccessKeyId);
    userIdentityMenu.add(mnuUiUsername);
    userIdentityMenu.add(mnuUiInvokedBy);
    userIdentityMenu.add(getSessionContextMenu(buttonGroup));

    return userIdentityMenu;
}

From source file:edu.clemson.cs.nestbed.client.gui.TestbedManagerFrame.java

private final JMenu buildConfigurationMenu() {
    final JMenu menu = new JMenu("Configuration");
    final JMenuItem addConfig = new JMenuItem("Add");
    final JMenuItem cloneConfig = new JMenuItem("Clone");
    final JMenuItem modifyConfig = new JMenuItem("Modify");
    final JMenuItem deleteConfig = new JMenuItem("Delete");
    final JMenuItem viewNetMonitor = new JMenuItem("View Network Monitor");

    addConfig.addActionListener(new AddConfigurationActionListener());
    menu.add(addConfig);//ww w  . j  a  v a 2 s. c o  m

    cloneConfig.addActionListener(new CloneConfigurationActionListener());
    menu.add(cloneConfig);

    modifyConfig.addActionListener(new ViewConfigurationActionListener());
    menu.add(modifyConfig);

    deleteConfig.addActionListener(new DeleteConfigurationActionListener());
    menu.add(deleteConfig);

    menu.add(new JSeparator());
    viewNetMonitor.addActionListener(new ViewNetworkMonitorActionListener());
    menu.add(viewNetMonitor);

    menu.addMenuListener(
            new ConfigurationMenuListener(addConfig, cloneConfig, deleteConfig, modifyConfig, viewNetMonitor));
    return menu;
}

From source file:kr.ac.kaist.swrc.jhannanum.demo.GUIDemo.java

/**
 * Sets the GUI up and launch the demo.//from ww w  .j  a v  a  2  s  . com
 */
public void run() {
    ///////////////////////////////////////////////////////////////////
    // Basic setting for the mainFrame                                    
    ///////////////////////////////////////////////////////////////////
    mainFrame = new JFrame();

    Toolkit kit = mainFrame.getToolkit();
    Dimension windowSize = kit.getScreenSize();

    mainFrame.setBounds(windowSize.width / 20, windowSize.height / 20, windowSize.width * 18 / 20,
            windowSize.height * 18 / 20);
    mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    mainFrame.setTitle("HanNanum Korean Morphological Analyzer - A Plug-in Component based System (GUI Demo)");

    Font font = new Font("MonoSpaced", Font.PLAIN, 12);
    UIManager.put("TextArea.font", font);

    ///////////////////////////////////////////////////////////////////
    // Layout setting for the mainFrame                  
    ///////////////////////////////////////////////////////////////////
    mainFrame.setLayout(new BorderLayout());
    mainFrame.getContentPane().add(createPaneCenter(), BorderLayout.CENTER);
    mainFrame.getContentPane().add(createPaneNorth(), BorderLayout.NORTH);

    ///////////////////////////////////////////////////////////////////
    // Menu Setting                                 
    ///////////////////////////////////////////////////////////////////      
    menuBar = new JMenuBar();
    menuFile = new JMenu("File");
    menuItemFileOpen = new JMenuItem("Open", KeyEvent.VK_O);
    menuHelp = new JMenu("Help");
    menuItemHelp = new JMenuItem("Help", KeyEvent.VK_H);

    menuItemFileOpen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.ALT_MASK));
    menuItemHelp.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, ActionEvent.ALT_MASK));

    menuBar.add(menuFile);
    menuBar.add(menuHelp);
    menuFile.add(menuItemFileOpen);
    menuHelp.add(menuItemHelp);
    mainFrame.setJMenuBar(menuBar);

    ///////////////////////////////////////////////////////////////////
    // Event Handler Setting                                 
    ///////////////////////////////////////////////////////////////////
    menuItemFileOpen.addActionListener(new SharedActionHandler());
    menuItemHelp.addActionListener(new SharedActionHandler());
    buttonActivate.addActionListener(new SharedActionHandler());
    buttonAnalysis.addActionListener(new SharedActionHandler());
    buttonReset.addActionListener(new SharedActionHandler());
    radioMultiThread.addActionListener(new SharedActionHandler());
    radioSingleThread.addActionListener(new SharedActionHandler());

    listPluginMajor2.addMouseListener(new PluginListMouseListener(listPluginMajor2, listModelMajor2));
    listPluginMajor3.addMouseListener(new PluginListMouseListener(listPluginMajor3, listModelMajor3));
    listPluginSupplement1
            .addMouseListener(new PluginListMouseListener(listPluginSupplement1, listModelSupplement1));
    listPluginSupplement2
            .addMouseListener(new PluginListMouseListener(listPluginSupplement2, listModelSupplement2));
    listPluginSupplement3
            .addMouseListener(new PluginListMouseListener(listPluginSupplement3, listModelSupplement3));

    listPluginMajor2.setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE2, PluginInfo.MAJOR));
    listPluginMajor3.setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE3, PluginInfo.MAJOR));
    listPluginSupplement1
            .setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE1, PluginInfo.SUPPLEMENT));
    listPluginSupplement2
            .setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE2, PluginInfo.SUPPLEMENT));
    listPluginSupplement3
            .setTransferHandler(new PluginTransferHandler(PluginInfo.PHASE3, PluginInfo.SUPPLEMENT));

    listPluginSupplement1.setDropMode(DropMode.ON_OR_INSERT);
    listPluginSupplement2.setDropMode(DropMode.ON_OR_INSERT);
    listPluginSupplement3.setDropMode(DropMode.ON_OR_INSERT);
    listPluginMajor2.setDropMode(DropMode.ON_OR_INSERT);
    listPluginMajor3.setDropMode(DropMode.ON_OR_INSERT);

    listPluginMajor2.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginMajor3.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginSupplement1.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginSupplement2.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listPluginSupplement3.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    listPluginMajor2.setDragEnabled(true);
    listPluginMajor3.setDragEnabled(true);
    listPluginSupplement1.setDragEnabled(true);
    listPluginSupplement2.setDragEnabled(true);
    listPluginSupplement3.setDragEnabled(true);

    tree.setDragEnabled(true);
    tempPlugin = new PluginInfo("", 0, 0);

    workflow = new Workflow();

    // Show the main frame on the screen
    mainFrame.setVisible(true);

    for (int i = 0; i < tree.getRowCount(); i++) {
        tree.expandRow(i);
    }

    splitPaneTop.setDividerLocation(0.3);
    splitPaneBottom.setDividerLocation(0.5);
}

From source file:com.mightypocket.ashot.Mediator.java

private JMenuBar createMenuBar() {
    BindingGroup menuBinding = new BindingGroup();
    ResourceMap resourceMap = application.getContext().getResourceMap(Mediator.class);
    ApplicationActionMap actionMap = getActionMap();
    JMenuBar bar = new JMenuBar();

    // Menu File//from w  w  w  . jav  a 2 s  . co m
    JMenu menuFile = new JMenu(resourceMap.getString("menu.file"));
    menuFileDevices = new JMenu(resourceMap.getString("menu.file.devices.text"));
    menuFileDevices.setIcon(resourceMap.getIcon("menu.file.devices.icon"));
    menuFile.add(menuFileDevices);
    menuBinding.addBinding(bindRead(this, PROP_DEVICES, menuFileDevices, "enabled"));
    menuFile.addSeparator();
    menuFile.add(new JMenuItem(actionMap.get(ACTION_SAVE_SCREENSHOT)));
    menuFile.add(new JCheckBoxMenuItem(actionMap.get(ACTION_RECORDING)));
    menuFile.add(new JMenuItem(actionMap.get(ACTION_OPEN_DESTINATION_FOLDER)));
    menuFile.addSeparator();
    menuFile.add(new JMenuItem(actionMap.get(ACTION_CHANGE_DEFAULT_FOLDER)));
    menuFile.add(new JMenuItem(actionMap.get(ACTION_CHANGE_SDK_FOLDER)));
    menuFile.addSeparator();
    menuFile.add(new JMenuItem(actionMap.get("quit")));

    // Menu Edit
    JMenu menuEdit = new JMenu(resourceMap.getString("menu.edit"));
    menuEdit.add(new JMenuItem(actionMap.get(ACTION_COPY_TO_CLIPBOARD)));

    // Menu View
    JMenu menuView = new JMenu(resourceMap.getString("menu.view"));
    menuView.add(new JCheckBoxMenuItem(actionMap.get(ACTION_SHOW_TOOLBAR_LABELS)));
    menuView.addSeparator();
    menuView.add(new JCheckBoxMenuItem(actionMap.get(ACTION_LANDSCAPE)));
    menuView.add(new JCheckBoxMenuItem(actionMap.get(ACTION_LANDSCAPE_CW)));
    menuView.addSeparator();
    menuView.add(new JMenuItem(actionMap.get(ACTION_ZOOM_IN)));
    menuView.add(new JMenuItem(actionMap.get(ACTION_ZOOM_OUT)));
    menuView.add(new JMenuItem(actionMap.get(ACTION_SIZE_ORIGINAL)));
    menuView.add(new JMenuItem(actionMap.get(ACTION_SIZE_SMALL)));
    menuView.add(new JMenuItem(actionMap.get(ACTION_SIZE_LARGE)));
    menuView.add(new JCheckBoxMenuItem(actionMap.get(ACTION_SIZE_FIT)));
    menuView.addSeparator();
    menuView.add(new JMenuItem(actionMap.get(ACTION_FULL_SCREEN)));

    // Menu Tools
    JMenu toolsView = new JMenu(resourceMap.getString("menu.tools"));
    toolsView.add(new JMenuItem(actionMap.get(ACTION_INSTALL)));
    toolsView.addSeparator();
    toolsView.add(new JMenuItem(actionMap.get(ACTION_OPTIONS)));

    // Menu Help
    JMenu menuHelp = new JMenu(resourceMap.getString("menu.help"));
    menuHelp.add(new JMenuItem(actionMap.get(ACTION_CHECK_UPDATES)));
    menuHelp.add(new JMenuItem(actionMap.get(ACTION_ABOUT)));

    bar.add(menuFile);
    bar.add(menuEdit);
    bar.add(menuView);
    bar.add(toolsView);
    bar.add(menuHelp);

    menuBinding.bind();

    return bar;
}