Example usage for javax.swing JMenuBar add

List of usage examples for javax.swing JMenuBar add

Introduction

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

Prototype

public JMenu add(JMenu c) 

Source Link

Document

Appends the specified menu to the end of the menu bar.

Usage

From source file:MainClass.java

public MainClass() {
    JFrame frame = new JFrame();
    JTextPane textPane = new JTextPane();
    JScrollPane scrollPane = new JScrollPane(textPane);

    JPanel north = new JPanel();

    JMenuBar menu = new JMenuBar();
    JMenu styleMenu = new JMenu();
    styleMenu.setText("Style");

    Action boldAction = new BoldAction();
    boldAction.putValue(Action.NAME, "Bold");
    styleMenu.add(boldAction);/*from w  ww . java  2 s. c  o m*/

    Action italicAction = new ItalicAction();
    italicAction.putValue(Action.NAME, "Italic");
    styleMenu.add(italicAction);

    Action foregroundAction = new ForegroundAction();
    foregroundAction.putValue(Action.NAME, "Color");
    styleMenu.add(foregroundAction);

    Action formatTextAction = new FontAndSizeAction();
    formatTextAction.putValue(Action.NAME, "Font and Size");
    styleMenu.add(formatTextAction);

    menu.add(styleMenu);

    north.add(menu);
    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add(north, BorderLayout.NORTH);
    frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
    frame.setSize(800, 500);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:daylightchart.gui.DaylightChartGui.java

private void createActions(final JMenuBar menuBar, final JToolBar toolBar) {
    final JMenu menu = new JMenu(Messages.getString("DaylightChartGui.Menu.Actions")); //$NON-NLS-1$
    menu.setMnemonic('A');

    for (final LocationsListOperation operation : LocationsListOperation.values()) {
        final GuiAction action = operation.getAction(this);
        menu.add(action);/*from   www . j  a  v  a2  s . c  om*/
    }

    menu.addSeparator();
    menu.add(new GetCountriesFilesAction());
    menu.add(new GetUSStatesFilesAction());

    menu.addSeparator();
    menu.add(new CloseCurrentTabAction(locationsTabbedPane));

    menuBar.add(menu);
}

From source file:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java

private void addMenubar() {
    final JMenuBar menuBar = new JMenuBar();
    final JMenu providerMenu = getProviderMenu();
    final JMenu serverMenu = getServerMenu();
    final JMenu helpMenu = getHelpMenu();

    menuBar.add(providerMenu);
    menuBar.add(serverMenu);/*from   w ww  .j a  v a  2  s  .  com*/

    menuBar.add(helpMenu);

    setJMenuBar(menuBar);
}

From source file:ee.ioc.cs.vsle.editor.Editor.java

/**
 * //from  w ww .  j a  v  a  2  s .c  o  m
 */
private void makeToolsMenu(JMenuBar _menuBar) {

    JMenu menu = new JMenu(Menu.MENU_TOOLS);
    menu.setMnemonic(KeyEvent.VK_T);
    _menuBar.add(menu);

    JMenuItem menuItem = new JMenuItem(Menu.EXPERT_TABLE);
    menuItem.addActionListener(getActionListener());
    menu.add(menuItem);

    if (RuntimeProperties.isFromWebstart()) {
        menuItem = new JMenuItem(Menu.ICON_EDITOR);
        menuItem.addActionListener(getActionListener());
        menu.add(menuItem);
    }

    menuItem = new JCheckBoxMenuItem(Menu.SHOW_ALGORITHM, RuntimeProperties.isShowAlgorithm());
    menuItem.setToolTipText("If checked, after planning a window with the synthesized algorithm will be shown");
    menuItem.addActionListener(getActionListener());
    menu.add(menuItem);

    menuItem = new JMenuItem(Menu.VIEW_THREADS);
    menuItem.addActionListener(getActionListener());
    menu.add(menuItem);

    menuItem = new JMenuItem(Menu.JAVA_CONSOLE);
    menuItem.addActionListener(getActionListener());
    menu.add(menuItem);
}

From source file:net.sf.jhylafax.JHylaFAX.java

private void initializeMenuBar() {
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);/*ww  w. j  a  va2s  . co  m*/

    fileMenu = new JMenu();
    menuBar.add(fileMenu);
    JComponent item = Builder.createMenuItem(sendAction);
    sendActionShortcut.setMenuItem((JMenuItem) item);
    fileMenu.add(item);
    fileMenu.add(Builder.createMenuItem(pollAction));
    fileMenu.addSeparator();
    item = Builder.createMenuItem(updateStatusAction);
    fileMenu.add(item);
    updateStatusActionShortcut.setMenuItem((JMenuItem) item);
    fileMenu.addSeparator();
    fileMenu.add(Builder.createMenuItem(settingsDialogAction));
    fileMenu.add(Builder.createMenuItem(settingsWizardAction));
    fileMenu.addSeparator();
    fileMenu.add(Builder.createMenuItem(addressBookAction));
    fileMenu.addSeparator();
    fileMenu.add(Builder.createMenuItem(exitAction));

    helpMenu = new JMenu();
    menuBar.add(helpMenu);
    helpMenu.add(Builder.createMenuItem(new WhatsThisAction()));
    helpMenu.addSeparator();
    helpMenu.add(Builder.createMenuItem(aboutAction));
}

From source file:br.ufrgs.enq.jcosmo.ui.COSMOSACDialog.java

public COSMOSACDialog() {
    super("JCOSMO Simple");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLayout(new BorderLayout());

    db = COSMOSACDataBase.getInstance();

    COSMOSAC models[] = new COSMOSAC[5];
    models[0] = new COSMOSAC();
    models[1] = new COSMOPAC();
    models[2] = new COSMOSAC_SVP();
    models[3] = new COSMOSAC_G();
    models[4] = new PCMSAC();
    modelBox = new JComboBox(models);
    modelBox.addActionListener(this);

    JPanel north = new JPanel(new GridLayout(0, 2));
    add(north, BorderLayout.NORTH);
    JPanel northAba1 = new JPanel(new GridLayout(0, 4));
    JPanel northAba2 = new JPanel(new GridLayout(0, 2));

    //Where the GUI is created:
    JMenuBar menuBar;
    JMenu file, help;//from  w  ww .j a  va 2 s  .c  o  m
    JMenuItem menuItem;

    //Create the menu bar.
    menuBar = new JMenuBar();

    // the file menu
    file = new JMenu("File");
    file.setMnemonic(KeyEvent.VK_F);
    menuBar.add(file);
    menuItem = new JMenuItem("Quit", KeyEvent.VK_Q);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK));
    menuItem.setActionCommand(QUIT);
    menuItem.addActionListener(this);
    file.add(menuItem);

    // the help menu
    help = new JMenu("Help");
    file.setMnemonic(KeyEvent.VK_H);
    menuBar.add(help);
    menuItem = new JMenuItem("About", KeyEvent.VK_A);
    menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
    menuItem.setActionCommand(ABOUT);
    menuItem.addActionListener(this);
    help.add(menuItem);

    setJMenuBar(menuBar);

    listModel = new DefaultListModel();
    list = new JList(listModel);
    list.setBorder(BorderFactory.createTitledBorder("compounds"));
    list.setVisibleRowCount(2);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane listScrollPane = new JScrollPane(list);

    JButton addButton = new JButton("Add");
    addButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            new AddCompoundDialog(COSMOSACDialog.this);
        }
    });

    removeButton = new JButton("Remove");
    removeButton.addActionListener(this);
    visibRemove(false);

    JButton calcButton = new JButton("Calculate");
    calcButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            rebuildChart();
            rebuildSigmaProfiles();
        }
    });

    JButton refreshButton = new JButton("Refresh");
    refreshButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            rebuildSigmaProfiles();
        }
    });

    ignoreSGButton = new JCheckBox("Ignore SG");
    ignoreSGButton.setToolTipText("Toogles the ignore flag for the Staverman-Guggenheim term");
    ignoreSGButton.addActionListener(this);

    JPanel but = new JPanel(new GridLayout(0, 1));
    but.add(addButton, BorderLayout.EAST);
    but.add(removeButton, BorderLayout.EAST);
    but.add(modelBox);
    north.add(listScrollPane);
    north.add(but);

    northAba1.add(new JLabel("Temperature [K]"));
    northAba1.add(temperature = new JTextField(10));
    temperature.setText("298");

    northAba1.add(new JLabel("Sigma HB"));
    northAba1.add(sigmaHB = new JTextField(10));
    northAba1.add(new JLabel("Sigma HB2"));
    northAba1.add(sigmaHB2 = new JTextField(10));
    northAba1.add(new JLabel("Sigma HB3"));
    northAba1.add(sigmaHB3 = new JTextField(10));

    northAba1.add(new JLabel("Charge HB"));
    northAba1.add(chargeHB = new JTextField(10));

    northAba1.add(new JLabel("Sigma Disp"));
    northAba1.add(sigmaDisp = new JTextField(10));
    northAba1.add(new JLabel("Charge Disp"));
    northAba1.add(chargeDisp = new JTextField(10));

    northAba1.add(new JLabel("Beta"));
    northAba1.add(beta = new JTextField(10));
    northAba1.add(new JLabel("fpol"));
    northAba1.add(fpol = new JTextField(10));
    northAba1.add(new JLabel("Anorm"));
    northAba1.add(anorm = new JTextField(10));

    northAba1.add(ignoreSGButton);
    northAba1.add(calcButton);
    northAba2.add(new JLabel(""));
    northAba2.add(refreshButton);

    //      chart = new JLineChart();
    //      add(chart, BorderLayout.CENTER);
    //      chart.setTitle("Gamma Plot");
    //      chart.setSubtitle("");
    //      chart.setXAxisLabel("Mole Fraction, x_1");
    //      chart.setYAxisLabel("ln gamma, gE/RT");
    //      chart.setSource(getTitle());
    //      chart.setLegendPosition(LegendPosition.BOTTOM);
    //      chart.setShapesVisible(true);

    JFreeChart chart = ChartFactory.createXYLineChart(null, "Mole Fraction, x_1", "ln gamma, gE/RT", null,
            PlotOrientation.VERTICAL, true, true, false);
    plot = (XYPlot) chart.getPlot();
    plot.getDomainAxis().setAutoRange(false);
    plot.getDomainAxis().setRange(new Range(0.0, 1.0));

    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plot.getRenderer();
    r.setUseFillPaint(true);
    r.setBaseFillPaint(Color.white);
    r.setBaseShapesVisible(true);

    JFreeChart sigmaProfileChart = ChartFactory.createXYLineChart(null, "sigma", "P^x", null,
            PlotOrientation.VERTICAL, true, true, false);
    sigmaProfilePlot = sigmaProfileChart.getXYPlot();
    sigmaProfilePlot.getDomainAxis().setAutoRange(false);
    sigmaProfilePlot.getDomainAxis().setRange(new Range(-0.025, 0.025));

    //      sigmaProfilePlot.setBackgroundPaint(Color.lightGray);
    //      sigmaProfilePlot.setDomainGridlinePaint(Color.white);
    //      sigmaProfilePlot.setRangeGridlinePaint(Color.white);

    JFreeChart chartSegGamma = ChartFactory.createXYLineChart(null, "sigma", "Segment Gamma", null,
            PlotOrientation.VERTICAL, true, true, false);
    plotSegGamma = (XYPlot) chartSegGamma.getPlot();

    JPanel south = new JPanel();
    south.setLayout(new FlowLayout());
    south.add(new JLabel("<html>ln &gamma;<sup>&infin;</sup><sub>1</sub>:</html>"));
    south.add(lnGammaInf1Label = new JLabel());
    south.add(new JLabel("<html>ln &gamma;<sup>&infin;</sup><sub>2</sub>:</html>"));
    south.add(lnGammaInf2Label = new JLabel());
    south.add(Box.createHorizontalStrut(20));
    south.add(new JLabel("<html>&gamma;<sup>&infin;</sup><sub>1</sub>:</html>"));
    south.add(gammaInf1Label = new JLabel());
    south.add(new JLabel("<html>&gamma;<sup>&infin;</sup><sub>2</sub>:</html>"));
    south.add(gammaInf2Label = new JLabel());

    JPanel aba1 = new JPanel(new BorderLayout());
    aba1.add(northAba1, BorderLayout.NORTH);
    JPanel chartsPanel = new JPanel(new GridLayout(0, 2));
    aba1.add(chartsPanel, BorderLayout.CENTER);
    chartsPanel.add(new ChartPanel(chart));
    chartsPanel.add(new ChartPanel(chartSegGamma));
    aba1.add(south, BorderLayout.SOUTH);

    JPanel aba2 = new JPanel(new BorderLayout());
    aba2.add(northAba2, BorderLayout.NORTH);
    aba2.add(chartPanel = new ChartPanel(sigmaProfileChart), BorderLayout.CENTER);

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("gamma", aba1);
    tabbedPane.addTab("sigma", aba2);
    add(tabbedPane, BorderLayout.CENTER);

    //      cosmosac.setAEffPrime(6.596176570595075);
    //      cosmosac.setCoord(11.614599507917934);
    //      cosmosac.setVnorm(56.36966406129967);
    //      cosmosac.setAnorm(41.56058649432742);
    //      cosmosac.setCHB(65330.19484947528);
    //      cosmosac.setSigmaHB(0.008292411048046008);

    //Display the window.
    setSize(800, 600);
    setLocationRelativeTo(null);
    modelBox.setSelectedIndex(0);
    setVisible(true);

    // test for a mixture
    //      addList("WATER");
    //      addList("H3O+1");
    //      addList("OH-1");
    //      addList("CL-1");
    //      addList("OXYGEN");
    //      addList("sec-butylamine");
    //      addList("hydrogen-fluoride");
    //      addList("ACETONE");
    //      addList("METHANOL");
    //      addList("ACETONE.opt");
    //      addList("METHANOL.opt");
    //      addList("METHYL-ETHYL-KETONE");
    //      addList("ETHANOL");
    //      addList("N-HEPTANE");
    //      addList("PROPIONIC-ACID");
    //      addList("EMIM");
    //      addList("NTF2");
    //      addList("DCA");
    //      addList("N-OCTANE");
    addList("ETHYLENE CARBONATE");
    addList("BENZENE");
    addList("TOLUENE");
    removeButton.setEnabled(true);
}

From source file:JXButtonPanel.java

public JXButtonPanelDemo() {
    super("JXButtonPanel demo");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);//from  w w w  . ja v  a2s  .  c  o m
    JPanel topPanel = new JPanel(new GridLayout(1, 0));

    final JXButtonPanel radioGroupPanel = createRadioJXButtonPanel();
    topPanel.add(radioGroupPanel);

    final JXButtonPanel checkBoxPanel = createCheckBoxJXButtonPanel();
    topPanel.add(checkBoxPanel);

    add(topPanel);
    add(createButtonJXButtonPanel(), BorderLayout.SOUTH);
    pack();

    JMenuBar bar = new JMenuBar();
    JMenu menu = new JMenu("Options");
    JMenuItem item = new JMenuItem("Unselect radioButtons");
    item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.ALT_MASK));
    item.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // hack for 1.5 
            // in 1.6 ButtonGroup.clearSelection added
            JRadioButton b = new JRadioButton();
            radioGroup.add(b);
            b.setSelected(true);
            radioGroup.remove(b);
        }
    });
    menu.add(item);
    bar.add(menu);
    setJMenuBar(bar);

    setSize(300, 300);
    setLocationRelativeTo(null);
}

From source file:com.orange.atk.graphAnalyser.LectureJATKResult.java

/** This method is called from within the constructor to
 * initialize the form./*w w  w  .j a  va 2s. c o  m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
    jListGraph = new JList(listModel);
    jComboBoxLeft = new JComboBox(comboModelLeft);
    jComboBoxRight = new JComboBox(comboModelRight);
    jListMarker = new JList(listModelMarker);
    jTable2 = new javax.swing.JTable();
    jMenu1 = new javax.swing.JMenu();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    jComboBoxLeft.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jComboBoxLeftActionPerformed(evt);
        }
    });

    jComboBoxRight.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jComboBoxRightActionPerformed(evt);
        }
    });

    jTable2.setModel(modeltable);

    jMenu1.setText("File");

    JMenuItem jMenuItem1 = new JMenuItem();
    jMenuItem1.setText("Open Directory");
    jMenuItem1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            openDirectoryAction(evt);
        }
    });

    JMenuItem jMenuItem2 = new JMenuItem();
    jMenuItem2.setText("Add a reference Graph");
    jMenuItem2.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            jMenuItemaddGraphActionPerformed(evt);
        }
    });

    JMenuItem jMenuItem3 = new JMenuItem();
    jMenuItem3.setText("set Graph color");
    jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItemChangecolorActionPerformed(evt);
        }
    });

    JMenuItem jMenuItem4 = new JMenuItem();
    jMenuItem4.setText("save config file");
    jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jMenuItemSaveConfigFileActionPerformed(evt);
        }
    });
    jMenu1.add(jMenuItem1);
    jMenu1.add(jMenuItem2);
    jMenu1.add(jMenuItem3);
    jMenu1.add(jMenuItem4);

    JMenuBar jMenuBar1 = new JMenuBar();
    jMenuBar1.add(jMenu1);

    setJMenuBar(jMenuBar1);

    //organise JFRAME
    JPanel mainpanel = (JPanel) getContentPane();
    mainpanel.setLayout(new BorderLayout());

    mainpanel.add(chartPanel, BorderLayout.CENTER);

    JPanel toolPanel = new JPanel();
    toolPanel.setLayout(new FlowLayout());

    toolPanel.add(jComboBoxLeft);

    Box graphbox = Box.createVerticalBox();
    graphbox.add(new JLabel("List of Graph "));
    JScrollPane jspaneGraph = new JScrollPane();
    jspaneGraph.setViewportView(jListGraph);
    jspaneGraph.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jspaneGraph.setPreferredSize(new Dimension(150, 100));

    graphbox.add(jspaneGraph);
    //      graphbox.setBorder(BorderFactory.createLineBorder(Color.black));
    toolPanel.add(graphbox);

    Box markerbox = Box.createVerticalBox();
    markerbox.add(new JLabel("List of Marker"));
    JScrollPane jspaneMarker = new JScrollPane();
    jspaneMarker.setViewportView(jListMarker);
    jspaneMarker.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jspaneMarker.setPreferredSize(new Dimension(150, 100));
    markerbox.add(jspaneMarker);
    //      markerbox.setBorder(BorderFactory.createLineBorder(Color.black));
    toolPanel.add(markerbox);

    JScrollPane jspane = new JScrollPane();
    jspane.setViewportView(jTable2);
    jspane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    jspane.setPreferredSize(new Dimension(300, 100));
    toolPanel.add(jspane);
    toolPanel.add(jComboBoxRight);

    mainpanel.add(toolPanel, BorderLayout.NORTH);

    pack();
}

From source file:org.jax.maanova.test.gui.VolcanoPlotPanel.java

@SuppressWarnings("serial")
private JMenuBar createMenu() {
    JMenuBar menuBar = new JMenuBar();

    // the file menu
    JMenu fileMenu = new JMenu("File");
    fileMenu.add(this.saveGraphImageAction);
    menuBar.add(fileMenu);

    // the tools menu
    JMenu toolsMenu = new JMenu("Tools");
    JMenuItem configureGraphItem = new JMenuItem("Configure Graph...");
    configureGraphItem.addActionListener(new ActionListener() {
        /**//from  ww  w . ja  v a  2  s.  co m
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            VolcanoPlotPanel.this.chartConfigurationDialog.setVisible(true);
        }
    });
    toolsMenu.add(configureGraphItem);
    toolsMenu.addSeparator();

    toolsMenu.add(new AbstractAction("Clear Selections") {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            VolcanoPlotPanel.this.setSelectedIndices(new int[0]);
        }
    });
    toolsMenu.addSeparator();

    ButtonGroup dragButtonGroup = new ButtonGroup();
    JCheckBoxMenuItem selectModeCheckBox = new JCheckBoxMenuItem("Drag Cursor to Select");
    selectModeCheckBox.setSelected(true);
    this.dragToSelect = true;
    selectModeCheckBox.addItemListener(new ItemListener() {
        /**
         * {@inheritDoc}
         */
        public void itemStateChanged(ItemEvent e) {
            VolcanoPlotPanel.this.dragToSelect = e.getStateChange() == ItemEvent.SELECTED;
        }
    });
    dragButtonGroup.add(selectModeCheckBox);
    toolsMenu.add(selectModeCheckBox);

    JCheckBoxMenuItem zoomModeCheckBox = new JCheckBoxMenuItem("Drag Cursor to Zoom");
    zoomModeCheckBox.addItemListener(new ItemListener() {
        /**
         * {@inheritDoc}
         */
        public void itemStateChanged(ItemEvent e) {
            VolcanoPlotPanel.this.dragToZoom = e.getStateChange() == ItemEvent.SELECTED;
        }
    });
    dragButtonGroup.add(zoomModeCheckBox);
    toolsMenu.add(zoomModeCheckBox);
    toolsMenu.addSeparator();

    toolsMenu.add(new AbstractAction("Zoom Out") {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            VolcanoPlotPanel.this.autoRangeChart();
        }
    });
    toolsMenu.addSeparator();

    JCheckBoxMenuItem showTooltipCheckbox = new JCheckBoxMenuItem("Show Info Popup for Nearest Point");
    showTooltipCheckbox.setSelected(true);
    this.showTooltip = true;
    showTooltipCheckbox.addItemListener(new ItemListener() {
        /**
         * {@inheritDoc}
         */
        public void itemStateChanged(ItemEvent e) {
            VolcanoPlotPanel.this.showTooltip = e.getStateChange() == ItemEvent.SELECTED;
            VolcanoPlotPanel.this.clearProbePopup();
        }
    });
    toolsMenu.add(showTooltipCheckbox);
    toolsMenu.addSeparator();

    toolsMenu.add(this.displayTestResultsAction);
    toolsMenu.addSeparator();

    toolsMenu.add(this.saveSelectedPointsMenuItem);

    JMenu selectPointsFromLisMenu = new JMenu("Select Points From Gene List");
    List<String> geneListNames = this.maanovaTestResult.getParentExperiment().getGeneListNames();
    if (geneListNames.isEmpty()) {
        JMenuItem noListsMenuItem = new JMenuItem("No Gene Lists Available");
        noListsMenuItem.setEnabled(false);
        selectPointsFromLisMenu.add(noListsMenuItem);
    } else {
        for (final String geneListName : geneListNames) {
            JMenuItem currGeneListMenuItem = new JMenuItem(
                    RUtilities.fromRIdentifierToReadableName(geneListName));
            currGeneListMenuItem.addActionListener(new ActionListener() {
                /**
                 * {@inheritDoc}
                 */
                public void actionPerformed(ActionEvent e) {
                    VolcanoPlotPanel.this.selectedIndicesFromGeneList(geneListName);
                }
            });
            selectPointsFromLisMenu.add(currGeneListMenuItem);
        }
    }
    toolsMenu.add(selectPointsFromLisMenu);

    menuBar.add(toolsMenu);

    // the help menu
    JMenu helpMenu = new JMenu("Help");
    JMenuItem helpMenuItem = new JMenuItem("Help...");
    Icon helpIcon = new ImageIcon(VolcanoPlotPanel.class.getResource("/images/action/help-16x16.png"));
    helpMenuItem.setIcon(helpIcon);
    helpMenuItem.addActionListener(new ActionListener() {
        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            Maanova.getInstance().showHelp("volcano-plot", VolcanoPlotPanel.this);
        }
    });
    helpMenu.add(helpMenuItem);
    menuBar.add(helpMenu);

    return menuBar;
}

From source file:com.moss.bdbadmin.client.ui.BdbAdminClient.java

public BdbAdminClient(HttpClient httpClient, JFrame window, File configPath, ProxyFactory proxyFactory) {

    this.httpClient = httpClient;
    this.ancestor = window;
    this.configPath = configPath;
    this.proxyFactory = proxyFactory;

    try {//  w  ww .j a va  2s .co m
        configJaxbContext = JAXBContext.newInstance(ServiceConfig.class);
    } catch (JAXBException ex) {
        throw new RuntimeException(ex);
    }

    JMenuItem newServiceItem = new JMenuItem("New Service");
    newServiceItem.setAction(new NewServiceAction());

    JMenu fileMenu = new JMenu("File");
    fileMenu.add(newServiceItem);

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

    window.setJMenuBar(menuBar);
    window.setIconImage(new ImageIcon(this.getClass().getClassLoader().getResource("service.gif")).getImage());

    this.root = new DefaultMutableTreeNode();
    this.model = new DefaultTreeModel(root);
    getTree().setModel(model);
    getTree().setShowsRootHandles(true);
    getTree().setRootVisible(false);
    getTree().setCellRenderer(new Renderer());
    getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    getTree().getSelectionModel().addTreeSelectionListener(new SelectionListener());
    getTree().addMouseListener(new ContextMenuHandler());

    addAncestorListener(new AncestorListener() {
        public void ancestorAdded(AncestorEvent event) {
            loadConfig();
        }

        public void ancestorMoved(AncestorEvent event) {
        }

        public void ancestorRemoved(AncestorEvent event) {
        }
    });
}