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:SciTK.Plot.java

/** 
 * Load the initial UI/*from   ww  w . j av a 2s. co m*/
 */
protected final void initUI() {
    setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));

    // create a ChartPanel, and make it default to 1/4 of screen size:
    chart_panel = new ChartPanel(chart);
    chart_panel.setPreferredSize(new Dimension(def_width, def_height));

    //add the chart to the window:
    getContentPane().add(chart_panel);

    // create a menu bar:
    menubar = new JMenuBar();
    // ---------------------------------------------------------
    //                 First dropdown menu: "File"
    // ---------------------------------------------------------
    file = new JMenu("File");
    file.setMnemonic(KeyEvent.VK_F);

    // Set up a save dialog option under the file menu:
    JMenuItem menu_file_save;
    ImageIcon menu_file_save_icon = null;
    try {
        menu_file_save_icon = new ImageIcon(getClass().getResource("/SciTK/resources/document-save-5.png"));
        menu_file_save = new JMenuItem("Save", menu_file_save_icon);
    } catch (Exception e) {
        menu_file_save = new JMenuItem("Save");
    }
    menu_file_save.setMnemonic(KeyEvent.VK_S);
    menu_file_save.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    menu_file_save.setToolTipText("Save an image");
    menu_file_save.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            saveImage();
        }
    });
    file.add(menu_file_save);

    // Set up a save SVG dialog option under the file menu:
    JMenuItem menu_file_save_svg;
    try {
        menu_file_save_svg = new JMenuItem("Save VG", menu_file_save_icon);
    } catch (Exception e) {
        menu_file_save_svg = new JMenuItem("Save VG");
    }
    menu_file_save_svg.setToolTipText("Save as vector graphics (SVG,PS,EPS)");
    menu_file_save_svg.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            saveVectorGraphics();
        }
    });
    file.add(menu_file_save_svg);

    // Set up a save data dialog option under the file menu:
    JMenuItem menu_file_save_data;
    try {
        menu_file_save_data = new JMenuItem("Save data", menu_file_save_icon);
    } catch (Exception e) {
        menu_file_save_data = new JMenuItem("Save data");
    }
    menu_file_save_data.setToolTipText("Save raw data to file");
    menu_file_save_data.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            saveData();
        }
    });
    file.add(menu_file_save_data);

    // Set up a save data dialog option under the file menu:
    JMenuItem menu_file_print;
    try {
        ImageIcon menu_file_print_icon = new ImageIcon(
                getClass().getResource("/SciTK/resources/document-print-5.png"));
        menu_file_print = new JMenuItem("Print", menu_file_print_icon);
    } catch (Exception e) {
        menu_file_print = new JMenuItem("Print");
    }
    menu_file_print.setToolTipText("Print image of chart");
    menu_file_print.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            printPlot();
        }
    });
    file.add(menu_file_print);

    // menu item for exiting
    JMenuItem menu_file_exit;
    try {
        ImageIcon menu_file_exit_icon = new ImageIcon(
                getClass().getResource("/SciTK/resources/application-exit.png"));
        menu_file_exit = new JMenuItem("Exit", menu_file_exit_icon);
    } catch (Exception e) {
        menu_file_exit = new JMenuItem("Exit");
    }
    menu_file_exit.setMnemonic(KeyEvent.VK_X);
    menu_file_exit.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    menu_file_exit.setToolTipText("Exit application");
    menu_file_exit.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            dispose();
        }

    });
    file.add(menu_file_exit);

    // ---------------------------------------------------------
    //                 Second dropdown menu: "Edit"
    // ---------------------------------------------------------
    edit = new JMenu("Edit");
    edit.setMnemonic(KeyEvent.VK_E);

    // copy to clipboard
    JMenuItem menu_edit_copy_image;
    ImageIcon menu_edit_copy_icon = null;
    try {
        menu_edit_copy_icon = new ImageIcon(getClass().getResource("/SciTK/resources/edit-copy-7.png"));
        menu_edit_copy_image = new JMenuItem("Copy", menu_edit_copy_icon);
    } catch (Exception e) {
        menu_edit_copy_image = new JMenuItem("Copy");
    }
    menu_edit_copy_image.setMnemonic(KeyEvent.VK_C);
    menu_edit_copy_image.setAccelerator(
            KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
    menu_edit_copy_image.setToolTipText("Copy image to clipboard");
    menu_edit_copy_image.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            copyImage();
        }
    });
    edit.add(menu_edit_copy_image);

    // copy data to clipboard
    JMenuItem menu_edit_copy_data;
    try {
        menu_edit_copy_data = new JMenuItem("Copy data", menu_edit_copy_icon);
    } catch (Exception e) {
        menu_edit_copy_data = new JMenuItem("Copy data");
    }
    menu_edit_copy_data.setToolTipText("Copy data to clipboard");
    menu_edit_copy_data.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            copyData();
        }
    });
    edit.add(menu_edit_copy_data);

    // set background color
    JMenuItem menu_edit_BackgroundColor;
    ImageIcon menu_edit_Color_icon = null;
    try {
        menu_edit_Color_icon = new ImageIcon(getClass().getResource("/SciTK/resources/color-wheel.png"));
        menu_edit_BackgroundColor = new JMenuItem("Background Color", menu_edit_Color_icon);
    } catch (Exception e) {
        menu_edit_BackgroundColor = new JMenuItem("Background Color");
    }
    menu_edit_BackgroundColor.setToolTipText("Select background color");
    menu_edit_BackgroundColor.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            Color bgColor = plotColorChooser("Choose background color", (Color) chart.getBackgroundPaint());
            setBackgroundColor(bgColor);
        }
    });
    edit.add(menu_edit_BackgroundColor);

    // set plot color
    JMenuItem menu_edit_PlotColor;
    try {
        menu_edit_PlotColor = new JMenuItem("Window Color", menu_edit_Color_icon);
    } catch (Exception e) {
        menu_edit_PlotColor = new JMenuItem("Window Color");
    }
    menu_edit_PlotColor.setToolTipText("Select plot window color");
    menu_edit_PlotColor.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            Color plotColor = plotColorChooser("Choose plot color",
                    (Color) chart.getPlot().getBackgroundPaint());
            setWindowBackground(plotColor);
        }
    });
    edit.add(menu_edit_PlotColor);

    // set gridline color
    JMenuItem menu_edit_GridlineColor;
    try {
        menu_edit_GridlineColor = new JMenuItem("Gridline Color", menu_edit_Color_icon);
    } catch (Exception e) {
        menu_edit_GridlineColor = new JMenuItem("Gridline Color");
    }
    menu_edit_GridlineColor.setToolTipText("Select grid color");
    menu_edit_GridlineColor.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            Color gridColor = plotColorChooser("Choose grid color",
                    (Color) chart.getPlot().getBackgroundPaint());
            setGridlineColor(gridColor);
        }
    });
    edit.add(menu_edit_GridlineColor);

    // edit chart preferences
    JMenuItem menu_edit_preferences;
    try {
        ImageIcon menu_edit_preferences_icon = new ImageIcon(
                getClass().getResource("/SciTK/resources/preferences-desktop-3.png"));
        menu_edit_preferences = new JMenuItem("Preferences", menu_edit_preferences_icon);
    } catch (Exception e) {
        menu_edit_preferences = new JMenuItem("Preferences");
    }
    menu_edit_preferences.setToolTipText("Edit chart preferences");
    menu_edit_preferences.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            chart_panel.doEditChartProperties();
        }
    });
    edit.add(menu_edit_preferences);

    // ---------------------------------------------------------
    //                 Third dropdown menu: "Plot"
    // ---------------------------------------------------------
    plot = new JMenu("Plot");
    plot.setMnemonic(KeyEvent.VK_P);

    // Options to set log axes
    JCheckBoxMenuItem menu_plot_ylog = new JCheckBoxMenuItem("Log y axis");
    menu_plot_ylog.setToolTipText("Set y axis to logarithmic");
    menu_plot_ylog.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            AbstractButton aButton = (AbstractButton) event.getSource();
            boolean selected = aButton.getModel().isSelected();
            setRangeAxisLog(selected);
        }
    });
    plot.add(menu_plot_ylog);

    JCheckBoxMenuItem menu_plot_xlog = new JCheckBoxMenuItem("Log x axis");
    menu_plot_xlog.setToolTipText("Set x axis to logarithmic");
    menu_plot_xlog.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            AbstractButton aButton = (AbstractButton) event.getSource();
            boolean selected = aButton.getModel().isSelected();
            setDomainAxisLog(selected);
        }
    });
    plot.add(menu_plot_xlog);

    // grid line display
    JCheckBoxMenuItem menu_plot_grid = new JCheckBoxMenuItem("Grid lines");
    menu_plot_grid.setToolTipText("Show plot grid lines?");
    menu_plot_grid.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            AbstractButton aButton = (AbstractButton) event.getSource();
            boolean selected = aButton.getModel().isSelected();
            setGridlineVisible(selected);
        }
    });
    // set appropirate checkbox state:
    menu_plot_grid.setState(chart.getXYPlot().isDomainGridlinesVisible());
    plot.add(menu_plot_grid);

    // control for displaying plot legend
    JCheckBoxMenuItem menu_plot_legend = new JCheckBoxMenuItem("Legend");
    menu_plot_legend.setToolTipText("Show plot legend?");
    menu_plot_legend.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            AbstractButton aButton = (AbstractButton) event.getSource();
            boolean selected = aButton.getModel().isSelected();
            setLegend(selected);
        }
    });
    // set appropirate checkbox state:
    menu_plot_legend.setState((chart.getLegend() instanceof LegendTitle));
    plot.add(menu_plot_legend);

    // ---------------------------------------------------------
    //                 General UI
    // ---------------------------------------------------------
    // Add menus to the menu bar:
    menubar.add(file);
    menubar.add(edit);
    menubar.add(plot);
    // Set menubar as this JFrame's menu
    setJMenuBar(menubar);

    // set default plot colors:
    chart.setBackgroundPaint(new Color(255, 255, 255, 0));
    chart.getPlot().setBackgroundPaint(new Color(255, 255, 255, 255));
    setBackgroundAlpha(0.0f);

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    pack();
    setTitle(window_title);
    setLocationRelativeTo(null);
    setVisible(true);
}

From source file:com.mirth.connect.client.ui.components.rsta.MirthRSyntaxTextArea.java

public MirthRSyntaxTextArea(ContextType contextType, String styleKey, boolean autoCompleteEnabled) {
    super(new MirthRSyntaxDocument(styleKey));
    this.contextType = contextType;

    setBackground(UIConstants.BACKGROUND_COLOR);
    setSyntaxEditingStyle(styleKey);//from  www  .java 2s .c o m
    setCodeFoldingEnabled(true);
    setAntiAliasingEnabled(true);
    setWrapStyleWord(true);
    setAutoIndentEnabled(true);

    // Add a document listener so that the save button is enabled whenever changes are made.
    getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void changedUpdate(DocumentEvent e) {
            onChange();
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            onChange();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            onChange();
        }

        private void onChange() {
            if (saveEnabled) {
                PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
            }
        }
    });

    addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (saveEnabled) {
                boolean isAccelerated = (((e.getModifiers()
                        & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) > 0)
                        || ((e.getModifiers() & InputEvent.CTRL_MASK) > 0));
                if ((e.getKeyCode() == KeyEvent.VK_S) && isAccelerated) {
                    PlatformUI.MIRTH_FRAME.doContextSensitiveSave();
                }
            }
        }
    });

    undoMenuItem = new CustomMenuItem(this, new UndoAction(), ActionInfo.UNDO);
    redoMenuItem = new CustomMenuItem(this, new RedoAction(), ActionInfo.REDO);
    cutMenuItem = new CustomMenuItem(this, new CutAction(this), ActionInfo.CUT);
    copyMenuItem = new CustomMenuItem(this, new CopyAction(this), ActionInfo.COPY);
    pasteMenuItem = new CustomMenuItem(this, new PasteAction(), ActionInfo.PASTE);
    deleteMenuItem = new CustomMenuItem(this, new DeleteAction(), ActionInfo.DELETE);
    selectAllMenuItem = new CustomMenuItem(this, new SelectAllAction(), ActionInfo.SELECT_ALL);
    findReplaceMenuItem = new CustomMenuItem(this, new FindReplaceAction(this), ActionInfo.FIND_REPLACE);
    findNextMenuItem = new CustomMenuItem(this, new FindNextAction(this), ActionInfo.FIND_NEXT);
    clearMarkedOccurrencesMenuItem = new CustomMenuItem(this, new ClearMarkedOccurrencesAction(this),
            ActionInfo.CLEAR_MARKED_OCCURRENCES);
    foldingMenu = new JMenu("Folding");
    collapseFoldMenuItem = new CustomMenuItem(this, new CollapseFoldAction(), ActionInfo.FOLD_COLLAPSE);
    expandFoldMenuItem = new CustomMenuItem(this, new ExpandFoldAction(), ActionInfo.FOLD_EXPAND);
    collapseAllFoldsMenuItem = new CustomMenuItem(this, new CollapseAllFoldsAction(),
            ActionInfo.FOLD_COLLAPSE_ALL);
    collapseAllCommentFoldsMenuItem = new CustomMenuItem(this, new CollapseAllCommentFoldsAction(),
            ActionInfo.FOLD_COLLAPSE_ALL_COMMENTS);
    expandAllFoldsMenuItem = new CustomMenuItem(this, new ExpandAllFoldsAction(), ActionInfo.FOLD_EXPAND_ALL);
    displayMenu = new JMenu("Display");
    showTabLinesMenuItem = new CustomJCheckBoxMenuItem(this, new ShowTabLinesAction(this),
            ActionInfo.DISPLAY_SHOW_TAB_LINES);
    showWhitespaceMenuItem = new CustomJCheckBoxMenuItem(this, new ShowWhitespaceAction(this),
            ActionInfo.DISPLAY_SHOW_WHITESPACE);
    showLineEndingsMenuItem = new CustomJCheckBoxMenuItem(this, new ShowLineEndingsAction(this),
            ActionInfo.DISPLAY_SHOW_LINE_ENDINGS);
    wrapLinesMenuItem = new CustomJCheckBoxMenuItem(this, new WrapLinesAction(this),
            ActionInfo.DISPLAY_WRAP_LINES);
    macroMenu = new JMenu("Macro");
    beginMacroMenuItem = new CustomMenuItem(this, new BeginMacroAction(), ActionInfo.MACRO_BEGIN);
    endMacroMenuItem = new CustomMenuItem(this, new EndMacroAction(), ActionInfo.MACRO_END);
    playbackMacroMenuItem = new CustomMenuItem(this, new PlaybackMacroAction(), ActionInfo.MACRO_PLAYBACK);
    viewUserAPIMenuItem = new CustomMenuItem(this, new ViewUserAPIAction(this), ActionInfo.VIEW_USER_API);

    // Add actions that wont be in the popup menu
    getActionMap().put(ActionInfo.DELETE_REST_OF_LINE.getActionMapKey(), new DeleteRestOfLineAction());
    getActionMap().put(ActionInfo.DELETE_LINE.getActionMapKey(), new DeleteLineAction());
    getActionMap().put(ActionInfo.JOIN_LINE.getActionMapKey(), new JoinLineAction());
    getActionMap().put(ActionInfo.GO_TO_MATCHING_BRACKET.getActionMapKey(), new GoToMatchingBracketAction());
    getActionMap().put(ActionInfo.TOGGLE_COMMENT.getActionMapKey(), new ToggleCommentAction());
    getActionMap().put(ActionInfo.DOCUMENT_START.getActionMapKey(), new DocumentStartAction(false));
    getActionMap().put(ActionInfo.DOCUMENT_SELECT_START.getActionMapKey(), new DocumentStartAction(true));
    getActionMap().put(ActionInfo.DOCUMENT_END.getActionMapKey(), new DocumentEndAction(false));
    getActionMap().put(ActionInfo.DOCUMENT_SELECT_END.getActionMapKey(), new DocumentEndAction(true));
    getActionMap().put(ActionInfo.LINE_START.getActionMapKey(), new LineStartAction(false));
    getActionMap().put(ActionInfo.LINE_SELECT_START.getActionMapKey(), new LineStartAction(true));
    getActionMap().put(ActionInfo.LINE_END.getActionMapKey(), new LineEndAction(false));
    getActionMap().put(ActionInfo.LINE_SELECT_END.getActionMapKey(), new LineEndAction(true));
    getActionMap().put(ActionInfo.MOVE_LEFT.getActionMapKey(), new MoveLeftAction(false));
    getActionMap().put(ActionInfo.MOVE_LEFT_SELECT.getActionMapKey(), new MoveLeftAction(true));
    getActionMap().put(ActionInfo.MOVE_LEFT_WORD.getActionMapKey(), new MoveLeftWordAction(false));
    getActionMap().put(ActionInfo.MOVE_LEFT_WORD_SELECT.getActionMapKey(), new MoveLeftWordAction(true));
    getActionMap().put(ActionInfo.MOVE_RIGHT.getActionMapKey(), new MoveRightAction(false));
    getActionMap().put(ActionInfo.MOVE_RIGHT_SELECT.getActionMapKey(), new MoveRightAction(true));
    getActionMap().put(ActionInfo.MOVE_RIGHT_WORD.getActionMapKey(), new MoveRightWordAction(false));
    getActionMap().put(ActionInfo.MOVE_RIGHT_WORD_SELECT.getActionMapKey(), new MoveRightWordAction(true));
    getActionMap().put(ActionInfo.MOVE_UP.getActionMapKey(), new MoveUpAction(false));
    getActionMap().put(ActionInfo.MOVE_UP_SELECT.getActionMapKey(), new MoveUpAction(true));
    getActionMap().put(ActionInfo.MOVE_UP_SCROLL.getActionMapKey(), new ScrollAction(true));
    getActionMap().put(ActionInfo.MOVE_UP_LINE.getActionMapKey(), new MoveLineAction(true));
    getActionMap().put(ActionInfo.MOVE_DOWN.getActionMapKey(), new MoveDownAction(false));
    getActionMap().put(ActionInfo.MOVE_DOWN_SELECT.getActionMapKey(), new MoveDownAction(true));
    getActionMap().put(ActionInfo.MOVE_DOWN_SCROLL.getActionMapKey(), new ScrollAction(false));
    getActionMap().put(ActionInfo.MOVE_DOWN_LINE.getActionMapKey(), new MoveLineAction(false));
    getActionMap().put(ActionInfo.PAGE_UP.getActionMapKey(), new PageUpAction(false));
    getActionMap().put(ActionInfo.PAGE_UP_SELECT.getActionMapKey(), new PageUpAction(true));
    getActionMap().put(ActionInfo.PAGE_LEFT_SELECT.getActionMapKey(), new HorizontalPageAction(this, true));
    getActionMap().put(ActionInfo.PAGE_DOWN.getActionMapKey(), new PageDownAction(false));
    getActionMap().put(ActionInfo.PAGE_DOWN_SELECT.getActionMapKey(), new PageDownAction(true));
    getActionMap().put(ActionInfo.PAGE_RIGHT_SELECT.getActionMapKey(), new HorizontalPageAction(this, false));
    getActionMap().put(ActionInfo.INSERT_LF_BREAK.getActionMapKey(), new InsertBreakAction("\n"));
    getActionMap().put(ActionInfo.INSERT_CR_BREAK.getActionMapKey(), new InsertBreakAction("\r"));

    List<Action> actionList = new ArrayList<Action>();
    for (Object key : getActionMap().allKeys()) {
        actionList.add(getActionMap().get(key));
    }
    actions = actionList.toArray(new Action[actionList.size()]);

    if (autoCompleteEnabled) {
        LanguageSupportFactory.get().register(this);
        // Remove the default auto-completion trigger since we handle that ourselves
        getInputMap().remove(AutoCompletion.getDefaultTriggerKey());
    }
}

From source file:blue.automation.AutomationManager.java

public JPopupMenu getAutomationMenu(SoundLayer soundLayer) {
    this.selectedSoundLayer = soundLayer;

    // if (menu == null || dirty) {
    JPopupMenu menu = new JPopupMenu();

    // Build Instrument Menu
    JMenu instrRoot = new JMenu("Instrument");

    Arrangement arrangement = data.getArrangement();

    ParameterIdList paramIdList = soundLayer.getAutomationParameters();

    for (int i = 0; i < arrangement.size(); i++) {
        InstrumentAssignment ia = arrangement.getInstrumentAssignment(i);

        if (ia.enabled && ia.instr instanceof Automatable) {

            ParameterList params = ((Automatable) ia.instr).getParameterList();

            if (params.size() <= 0) {
                continue;
            }/*from w  ww  .  j  a  v a 2  s .  c o  m*/

            JMenu instrMenu = new JMenu();
            instrMenu.setText(ia.arrangementId + ") " + ia.instr.getName());

            for (int j = 0; j < params.size(); j++) {
                Parameter param = params.getParameter(j);
                JMenuItem paramItem = new JMenuItem();
                paramItem.setText(param.getName());
                paramItem.addActionListener(parameterActionListener);

                if (param.isAutomationEnabled()) {
                    if (paramIdList.contains(param.getUniqueId())) {
                        paramItem.setForeground(Color.GREEN);
                    } else {
                        paramItem.setForeground(Color.ORANGE);
                    }

                }

                paramItem.putClientProperty("instr", ia.instr);
                paramItem.putClientProperty("param", param);

                instrMenu.add(paramItem);
            }
            instrRoot.add(instrMenu);
        }
    }

    menu.add(instrRoot);

    // Build Mixer Menu
    Mixer mixer = data.getMixer();

    if (mixer.isEnabled()) {
        JMenu mixerRoot = new JMenu("Mixer");

        // add channels
        ChannelList channels = mixer.getChannels();

        if (channels.size() > 0) {
            JMenu channelsMenu = new JMenu("Channels");

            for (int i = 0; i < channels.size(); i++) {
                channelsMenu.add(buildChannelMenu(channels.getChannel(i), soundLayer));
            }

            mixerRoot.add(channelsMenu);
        }

        // add subchannels
        ChannelList subChannels = mixer.getSubChannels();

        if (subChannels.size() > 0) {
            JMenu subChannelsMenu = new JMenu("Sub-Channels");
            for (int i = 0; i < subChannels.size(); i++) {
                subChannelsMenu.add(buildChannelMenu(subChannels.getChannel(i), soundLayer));
            }

            mixerRoot.add(subChannelsMenu);
        }

        // add master channel
        Channel master = mixer.getMaster();

        mixerRoot.add(buildChannelMenu(master, soundLayer));

        menu.add(mixerRoot);
    }

    menu.addSeparator();

    JMenuItem clearAll = new JMenuItem("Clear All");
    clearAll.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            Object retVal = DialogDisplayer.getDefault().notify(new NotifyDescriptor.Confirmation(
                    "Please Confirm Clearing All Parameter Data for this SoundLayer"));

            if (retVal == NotifyDescriptor.YES_OPTION) {

                ParameterIdList idList = selectedSoundLayer.getAutomationParameters();

                Iterator iter = new ArrayList(idList.getParameters()).iterator();

                while (iter.hasNext()) {
                    String paramId = (String) iter.next();
                    Parameter param = getParameter(paramId);

                    param.setAutomationEnabled(false);
                    idList.removeParameterId(paramId);
                }
            }
        }
    });
    menu.add(clearAll);

    clearAll.setEnabled(soundLayer.getAutomationParameters().size() > 0);

    // }

    // System.err.println(parameterMap);

    return menu;
}

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

private void addTopMenu() {

    JRadioButtonMenuItem mnuTop5 = new JRadioButtonMenuItem("Top 5");
    JRadioButtonMenuItem mnuTop10 = new JRadioButtonMenuItem("Top 10");

    mnuTop5.setActionCommand("top.5");
    mnuTop5.addActionListener(this);
    mnuTop5.setSelected(true);/*from   w w w. ja  v  a 2  s.c  o  m*/

    mnuTop10.setActionCommand("top.10");
    mnuTop10.addActionListener(this);

    topGroup.add(mnuTop5);
    topGroup.add(mnuTop10);

    JMenu menuTop = new JMenu("Top");
    menuTop.add(mnuTop5);
    menuTop.add(mnuTop10);

    menu.add(menuTop);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingTagFinderJInternalFrame.java

public JMenuBar getFinderMenuBar() {
    if (finderMenuBar == null) {
        JMenuItem menuItem;//from   w w w . j  a v  a2  s  .  c o  m
        finderMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        actionAddTag = new ActionAddTag();
        menuItem = new JMenuItem(actionAddTag);
        menuFile.add(menuItem);
        actionViewSelected = new ActionViewSelectedTag();
        menuItem = new JMenuItem(actionViewSelected);
        menuFile.add(menuItem);
        actionEditSelected = new ActionEditSelectedTag();
        menuItem = new JMenuItem(actionEditSelected);
        menuFile.add(menuItem);
        actionDeleteSelected = new ActionDeleteSelectedTag();
        menuItem = new JMenuItem(actionDeleteSelected);
        menuFile.add(menuItem);
        actionClose = new ActionClose();
        menuItem = new JMenuItem(actionClose);
        menuFile.add(menuItem);
        finderMenuBar.add(menuFile);
    }
    return (finderMenuBar);
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingTldFinderJInternalFrame.java

public JMenuBar getFinderMenuBar() {
    if (finderMenuBar == null) {
        JMenuItem menuItem;/*from   w w w  .j a v a2  s  .  co  m*/
        finderMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        actionAddTld = new ActionAddTld();
        menuItem = new JMenuItem(actionAddTld);
        menuFile.add(menuItem);
        actionViewSelected = new ActionViewSelectedTld();
        menuItem = new JMenuItem(actionViewSelected);
        menuFile.add(menuItem);
        actionEditSelected = new ActionEditSelectedTld();
        menuItem = new JMenuItem(actionEditSelected);
        menuFile.add(menuItem);
        actionDeleteSelected = new ActionDeleteSelectedTld();
        menuItem = new JMenuItem(actionDeleteSelected);
        menuFile.add(menuItem);
        actionClose = new ActionClose();
        menuItem = new JMenuItem(actionClose);
        menuFile.add(menuItem);
        finderMenuBar.add(menuFile);
    }
    return (finderMenuBar);
}

From source file:mendeley2kindle.MainUIFrame.java

public MainUIFrame(Properties config, Mendeley2Kindle core) {
    super("Mendeley2Kindle");
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    this.core = core;
    core.addStateListener(new UISyncStateListener());

    components = new ArrayList<JComponent>();

    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenuItem openMenuItem = new JMenuItem("Open Mendeley database");
    openMenuItem.addActionListener(new OpenMendeleyListener());
    JMenuItem selectKindleMenuItem = new JMenuItem("Select Kindle device path");
    selectKindleMenuItem.addActionListener(new SelectKindleListener());
    JMenuItem exitMenuItem = new JMenuItem("Quit");
    exitMenuItem.addActionListener(new QuitListener());
    fileMenu.add(openMenuItem);//  ww  w  . j  a  v  a2s.  com
    fileMenu.add(selectKindleMenuItem);
    fileMenu.add(exitMenuItem);
    menuBar.add(fileMenu);

    JMenu helpMenu = new JMenu("Help");
    JMenuItem aboutMenuItem = new JMenuItem("About");
    aboutMenuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String text = "Mendeley2Kindle 0.3.2\n"
                    + " (c) Copyright Yukinari Toyota, 2013. All rights reserved.\n"
                    + " Contact: Yukinari Toyota <xxseyxx@gmail.com>\n"
                    + " Site: http://sites.google.com/site/xxseyxx/\n" + "Some Icons by Yusuke Kamiyamane\n"
                    + " Site: http://p.yusukekamiyamane.com/\n"
                    + "sqlite-jdbc-3.7.2.jar is provided by xerial.org\n"
                    + " under Apache License version 2.0 (http://www.apache.org/licenses/ )\n"
                    + " Site: https://bitbucket.org/xerial/sqlite-jdbc\n";
            JOptionPane.showMessageDialog(MainUIFrame.this, text);
        }
    });
    helpMenu.add(aboutMenuItem);
    menuBar.add(helpMenu);

    setJMenuBar(menuBar);

    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));

    getContentPane().add(new JLabel("Select Mendeley collections"));

    collectionsJList = new JList();
    DragSelectionListener mil = new DragSelectionListener();
    collectionsJList.addMouseMotionListener(mil);
    collectionsJList.addMouseListener(mil);
    collectionsJList.setCellRenderer(new MyCellRenderer());
    // collectionsJList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    JScrollPane scroll = new JScrollPane();
    scroll.setPreferredSize(new Dimension(200, 300));
    scroll.getViewport().setView(collectionsJList);
    getContentPane().add(scroll);

    mainButton = new JButton("Open Mendeley database");
    mainButton.addActionListener(new OpenMendeleyListener());
    getContentPane().add(mainButton);

    components.add(collectionsJList);

    for (JComponent c : components)
        c.setEnabled(false);

    pack();
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingClusterFinderJInternalFrame.java

public JMenuBar getFinderMenuBar() {
    if (finderMenuBar == null) {
        JMenuItem menuItem;/* w  ww.jav  a 2  s .  co m*/
        finderMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        actionAddCluster = new ActionAddCluster();
        menuItem = new JMenuItem(actionAddCluster);
        menuFile.add(menuItem);
        actionViewSelected = new ActionViewSelectedCluster();
        menuItem = new JMenuItem(actionViewSelected);
        menuFile.add(menuItem);
        actionEditSelected = new ActionEditSelectedCluster();
        menuItem = new JMenuItem(actionEditSelected);
        menuFile.add(menuItem);
        actionDeleteSelected = new ActionDeleteSelectedCluster();
        menuItem = new JMenuItem(actionDeleteSelected);
        menuFile.add(menuItem);
        actionClose = new ActionClose();
        menuItem = new JMenuItem(actionClose);
        menuFile.add(menuItem);
        finderMenuBar.add(menuFile);
    }
    return (finderMenuBar);
}

From source file:daylightchart.gui.DaylightChartGui.java

private void createHelpMenu(final JMenuBar menuBar, final JToolBar toolBar) {

    final GuiAction onlineHelp = new OnlineHelpAction();
    final GuiAction about = new AboutAction(DaylightChartGui.this);

    final JMenu menuHelp = new JMenu(Messages.getString("DaylightChartGui.Menu.Help")); //$NON-NLS-1$
    menuHelp.setMnemonic('H');

    menuHelp.add(onlineHelp);//w  ww .  j  av  a  2 s .  co  m
    menuHelp.add(about);
    menuBar.add(menuHelp);

    toolBar.addSeparator();
    toolBar.add(onlineHelp);

}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccSwing.CFAccSwingSecUserFinderJInternalFrame.java

public JMenuBar getFinderMenuBar() {
    if (finderMenuBar == null) {
        JMenuItem menuItem;/*from   ww  w.ja va2  s .c o  m*/
        finderMenuBar = new JMenuBar();
        menuFile = new JMenu("File");
        actionAddSecUser = new ActionAddSecUser();
        menuItem = new JMenuItem(actionAddSecUser);
        menuFile.add(menuItem);
        actionViewSelected = new ActionViewSelectedSecUser();
        menuItem = new JMenuItem(actionViewSelected);
        menuFile.add(menuItem);
        actionEditSelected = new ActionEditSelectedSecUser();
        menuItem = new JMenuItem(actionEditSelected);
        menuFile.add(menuItem);
        actionDeleteSelected = new ActionDeleteSelectedSecUser();
        menuItem = new JMenuItem(actionDeleteSelected);
        menuFile.add(menuItem);
        actionClose = new ActionClose();
        menuItem = new JMenuItem(actionClose);
        menuFile.add(menuItem);
        finderMenuBar.add(menuFile);
    }
    return (finderMenuBar);
}