Example usage for javax.swing ButtonGroup add

List of usage examples for javax.swing ButtonGroup add

Introduction

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

Prototype

public void add(AbstractButton b) 

Source Link

Document

Adds the button to the group.

Usage

From source file:de.unikassel.jung.PluggableRendererDemo.java

/**
 * @param jp//from   ww w  . j a v  a  2s . co m
 *            panel to which controls will be added
 */
@SuppressWarnings("serial")
protected void addBottomControls(final JPanel jp) {
    final JPanel control_panel = new JPanel();
    jp.add(control_panel, BorderLayout.EAST);
    control_panel.setLayout(new BorderLayout());
    final Box vertex_panel = Box.createVerticalBox();
    vertex_panel.setBorder(BorderFactory.createTitledBorder("Vertices"));
    final Box edge_panel = Box.createVerticalBox();
    edge_panel.setBorder(BorderFactory.createTitledBorder("Edges"));
    final Box both_panel = Box.createVerticalBox();

    control_panel.add(vertex_panel, BorderLayout.NORTH);
    control_panel.add(edge_panel, BorderLayout.SOUTH);
    control_panel.add(both_panel, BorderLayout.CENTER);

    // set up vertex controls
    v_color = new JCheckBox("seed highlight");
    v_color.addActionListener(this);
    v_stroke = new JCheckBox("stroke highlight on selection");
    v_stroke.addActionListener(this);
    v_labels = new JCheckBox("show voltage values");
    v_labels.addActionListener(this);
    v_shape = new JCheckBox("shape by degree");
    v_shape.addActionListener(this);
    v_size = new JCheckBox("size by voltage");
    v_size.addActionListener(this);
    v_size.setSelected(true);
    v_aspect = new JCheckBox("stretch by degree ratio");
    v_aspect.addActionListener(this);
    v_small = new JCheckBox("filter when degree < " + VertexDisplayPredicate.MIN_DEGREE);
    v_small.addActionListener(this);

    vertex_panel.add(v_color);
    vertex_panel.add(v_stroke);
    vertex_panel.add(v_labels);
    vertex_panel.add(v_shape);
    vertex_panel.add(v_size);
    vertex_panel.add(v_aspect);
    vertex_panel.add(v_small);

    // set up edge controls
    JPanel gradient_panel = new JPanel(new GridLayout(1, 0));
    gradient_panel.setBorder(BorderFactory.createTitledBorder("Edge paint"));
    no_gradient = new JRadioButton("Solid color");
    no_gradient.addActionListener(this);
    no_gradient.setSelected(true);
    // gradient_absolute = new JRadioButton("Absolute gradient");
    // gradient_absolute.addActionListener(this);
    gradient_relative = new JRadioButton("Gradient");
    gradient_relative.addActionListener(this);
    ButtonGroup bg_grad = new ButtonGroup();
    bg_grad.add(no_gradient);
    bg_grad.add(gradient_relative);
    // bg_grad.add(gradient_absolute);
    gradient_panel.add(no_gradient);
    // gradientGrid.add(gradient_absolute);
    gradient_panel.add(gradient_relative);

    JPanel shape_panel = new JPanel(new GridLayout(3, 2));
    shape_panel.setBorder(BorderFactory.createTitledBorder("Edge shape"));
    e_line = new JRadioButton("line");
    e_line.addActionListener(this);
    e_line.setSelected(true);
    // e_bent = new JRadioButton("bent line");
    // e_bent.addActionListener(this);
    e_wedge = new JRadioButton("wedge");
    e_wedge.addActionListener(this);
    e_quad = new JRadioButton("quad curve");
    e_quad.addActionListener(this);
    e_cubic = new JRadioButton("cubic curve");
    e_cubic.addActionListener(this);
    e_ortho = new JRadioButton("orthogonal");
    e_ortho.addActionListener(this);
    ButtonGroup bg_shape = new ButtonGroup();
    bg_shape.add(e_line);
    // bg.add(e_bent);
    bg_shape.add(e_wedge);
    bg_shape.add(e_quad);
    bg_shape.add(e_ortho);
    bg_shape.add(e_cubic);
    shape_panel.add(e_line);
    // shape_panel.add(e_bent);
    shape_panel.add(e_wedge);
    shape_panel.add(e_quad);
    shape_panel.add(e_cubic);
    shape_panel.add(e_ortho);
    fill_edges = new JCheckBox("fill edge shapes");
    fill_edges.setSelected(false);
    fill_edges.addActionListener(this);
    shape_panel.add(fill_edges);
    shape_panel.setOpaque(true);
    e_color = new JCheckBox("highlight edge weights");
    e_color.addActionListener(this);
    e_labels = new JCheckBox("show edge weight values");
    e_labels.addActionListener(this);
    e_uarrow_pred = new JCheckBox("undirected");
    e_uarrow_pred.addActionListener(this);
    e_darrow_pred = new JCheckBox("directed");
    e_darrow_pred.addActionListener(this);
    e_darrow_pred.setSelected(true);
    e_arrow_centered = new JCheckBox("centered");
    e_arrow_centered.addActionListener(this);
    JPanel arrow_panel = new JPanel(new GridLayout(1, 0));
    arrow_panel.setBorder(BorderFactory.createTitledBorder("Show arrows"));
    arrow_panel.add(e_uarrow_pred);
    arrow_panel.add(e_darrow_pred);
    arrow_panel.add(e_arrow_centered);

    e_show_d = new JCheckBox("directed");
    e_show_d.addActionListener(this);
    e_show_d.setSelected(true);
    e_show_u = new JCheckBox("undirected");
    e_show_u.addActionListener(this);
    e_show_u.setSelected(true);
    JPanel show_edge_panel = new JPanel(new GridLayout(1, 0));
    show_edge_panel.setBorder(BorderFactory.createTitledBorder("Show edges"));
    show_edge_panel.add(e_show_u);
    show_edge_panel.add(e_show_d);

    shape_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
    edge_panel.add(shape_panel);
    gradient_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
    edge_panel.add(gradient_panel);
    show_edge_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
    edge_panel.add(show_edge_panel);
    arrow_panel.setAlignmentX(Component.LEFT_ALIGNMENT);
    edge_panel.add(arrow_panel);

    e_color.setAlignmentX(Component.LEFT_ALIGNMENT);
    edge_panel.add(e_color);
    e_labels.setAlignmentX(Component.LEFT_ALIGNMENT);
    edge_panel.add(e_labels);

    // set up zoom controls
    zoom_at_mouse = new JCheckBox("<html><center>zoom at mouse<p>(wheel only)</center></html>");
    zoom_at_mouse.addActionListener(this);
    zoom_at_mouse.setSelected(true);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    JPanel zoomPanel = new JPanel();
    zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom"));
    plus.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(plus);
    minus.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(minus);
    zoom_at_mouse.setAlignmentX(Component.CENTER_ALIGNMENT);
    zoomPanel.add(zoom_at_mouse);

    JPanel fontPanel = new JPanel();
    // add font and zoom controls to center panel
    font = new JCheckBox("bold text");
    font.addActionListener(this);
    font.setAlignmentX(Component.CENTER_ALIGNMENT);
    fontPanel.add(font);

    both_panel.add(zoomPanel);
    both_panel.add(fontPanel);

    JComboBox modeBox = gm.getModeComboBox();
    modeBox.setAlignmentX(Component.CENTER_ALIGNMENT);
    JPanel modePanel = new JPanel(new BorderLayout()) {
        @Override
        public Dimension getMaximumSize() {
            return getPreferredSize();
        }
    };
    modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    modePanel.add(modeBox);
    JPanel comboGrid = new JPanel(new GridLayout(0, 1));
    comboGrid.add(modePanel);
    fontPanel.add(comboGrid);

    JComboBox cb = new JComboBox();
    cb.addItem(Renderer.VertexLabel.Position.N);
    cb.addItem(Renderer.VertexLabel.Position.NE);
    cb.addItem(Renderer.VertexLabel.Position.E);
    cb.addItem(Renderer.VertexLabel.Position.SE);
    cb.addItem(Renderer.VertexLabel.Position.S);
    cb.addItem(Renderer.VertexLabel.Position.SW);
    cb.addItem(Renderer.VertexLabel.Position.W);
    cb.addItem(Renderer.VertexLabel.Position.NW);
    cb.addItem(Renderer.VertexLabel.Position.N);
    cb.addItem(Renderer.VertexLabel.Position.CNTR);
    cb.addItem(Renderer.VertexLabel.Position.AUTO);
    cb.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(final ItemEvent e) {
            Renderer.VertexLabel.Position position = (Renderer.VertexLabel.Position) e.getItem();
            vv.getRenderer().getVertexLabelRenderer().setPosition(position);
            vv.repaint();
        }
    });
    cb.setSelectedItem(Renderer.VertexLabel.Position.SE);
    JPanel positionPanel = new JPanel();
    positionPanel.setBorder(BorderFactory.createTitledBorder("Label Position"));
    positionPanel.add(cb);

    comboGrid.add(positionPanel);

}

From source file:org.gumtree.vis.awt.time.TimePlotChartEditor.java

private JPanel createCordinatePanel() {
    JPanel wrap = new JPanel(new BorderLayout());
    JPanel coordinate = new JPanel(new GridLayout(2, 1));
    coordinate.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    //Horizontal group
    JPanel horizontal = new JPanel(new BorderLayout());
    horizontal.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Time Axis"));

    JPanel inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    ButtonGroup axisControlGroup = new ButtonGroup();

    showAllHistory = new JRadioButton("Show all history");
    showAllHistory.setActionCommand(SHOW_ALL_HISTORY_COMMAND);
    showAllHistory.addActionListener(this);
    inner.add(showAllHistory);/*from  ww w.  j  a v a  2  s  .  c o  m*/
    inner.add(new JLabel());
    inner.add(new JLabel());
    //
    showPartHistory = new JRadioButton("Fix time range");
    showPartHistory.setActionCommand(FIXED_LENGTH_HISTORY_COMMAND);
    showPartHistory.addActionListener(this);
    inner.add(showPartHistory);
    timeField = new JTextField(5);
    inner.add(timeField);
    inner.add(new JLabel("seconds"));
    axisControlGroup.add(showAllHistory);
    axisControlGroup.add(showPartHistory);

    horizontal.add(inner, BorderLayout.NORTH);

    //Vertical group
    //       JPanel vertical = new JPanel(new BorderLayout());
    //       vertical.setBorder(BorderFactory.createTitledBorder(
    //            BorderFactory.createEtchedBorder(), "Vertical Axis"));
    //
    //       inner = new JPanel(new LCBLayout(6));
    //      inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    //      inner.add(new JLabel("Logarithm Y Axis"));
    //      logarithmY = new JCheckBox();
    //      logarithmY.setActionCommand(LOGARITHM_Y_AXIS_COMMAND);
    //      logarithmY.addActionListener(this);
    //      inner.add(logarithmY);
    //      inner.add(new JLabel());
    //
    //      inner.add(new JLabel("Flip Y Axis"));
    //      flipY = new JCheckBox();
    //      flipY.setActionCommand(FLIP_Y_AXIS_COMMAND);
    //      flipY.addActionListener(this);
    //      inner.add(flipY);
    //      inner.add(new JLabel());

    //       vertical.add(inner, BorderLayout.NORTH);

    coordinate.add(horizontal, BorderLayout.NORTH);
    //      coordinate.add(vertical);
    wrap.setName("Coordinate");
    wrap.add(coordinate, BorderLayout.NORTH);
    return wrap;
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.ImageFrame.java

/**
 * Constructor. /* w  ww.  j  a v  a2s .  c  o m*/
 */
public ImageFrame(final int mapSize, final WorkbenchPaneSS wbPane, final Workbench workbench,
        final Taskable task, final boolean isReadOnly) {
    this.wbPane = wbPane;
    this.workbench = workbench;

    try {
        this.workbenchTask = (WorkbenchTask) task;
    } catch (ClassCastException e) {
        this.workbenchTask = null;
    }

    this.allowCloseWindow = true;
    this.defaultThumbIcon = IconManager.getIcon("image", IconSize.Std32);

    setIconImage(IconManager.getImage("AppIcon").getImage());

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            if (allowCloseWindow) {
                wbPane.toggleImageFrameVisible();
            }
        }
    });

    Dimension minSize = new Dimension(mapSize, mapSize);
    cardImageLabel.setHorizontalTextPosition(SwingConstants.CENTER);

    PanelBuilder builder = new PanelBuilder(new FormLayout("f:p:g,c:p,f:p:g", "f:p:g,p,5px,p,f:p:g"));
    CellConstraints cc = new CellConstraints();

    loadImgBtn = createButton(getResourceString("WB_LOAD_NEW_IMAGE"));

    builder.add(createLabel(getResourceString("WB_NO_IMAGE_ROW"), SwingConstants.CENTER), cc.xy(2, 2));
    builder.add(loadImgBtn, cc.xy(2, 4));
    loadImgBtn.setVisible(!isReadOnly);

    noCardImageMessagePanel = builder.getPanel();
    noCardImageMessagePanel.setPreferredSize(minSize);
    noCardImageMessagePanel.setSize(minSize);

    builder = new PanelBuilder(new FormLayout("f:p:g,c:p,f:p:g", "f:p:g,c:p,f:p:g"));
    builder.add(createLabel(getResourceString("WB_NO_ROW_SELECTED"), SwingConstants.CENTER), cc.xy(2, 2));

    noRowSelectedMessagePanel = builder.getPanel();
    noRowSelectedMessagePanel.setPreferredSize(minSize);
    noRowSelectedMessagePanel.setSize(minSize);

    mainPane = new JPanel(new BorderLayout());
    mainPane.setSize(minSize);
    mainPane.setPreferredSize(minSize);
    mainPane.setMinimumSize(minSize);

    mainPane.add(cardImageLabel, BorderLayout.CENTER);
    scrollPane = new JScrollPane(mainPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    statusBar = new JStatusBar();

    thumbnailer = new ImageThumbnailGenerator();
    thumbnailer.setMaxSize(256, 256);
    thumbnailer.setQuality(1);

    tray = new ThumbnailTray();
    tray.getModel().removeAllElements();
    tray.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }

            setImageIndex(tray.getSelectedIndex());
        }
    });

    JPanel southPanel = new JPanel();
    southPanel.setLayout(new BorderLayout());

    //southPanel.add(indexSlider,BorderLayout.NORTH);
    southPanel.add(tray, BorderLayout.CENTER);
    southPanel.add(statusBar, BorderLayout.SOUTH);

    JPanel basePanel = new JPanel();
    basePanel.setLayout(new BorderLayout());
    basePanel.add(scrollPane, BorderLayout.CENTER);
    basePanel.add(southPanel, BorderLayout.SOUTH);

    setContentPane(basePanel);

    JMenuBar menuBar = new JMenuBar();

    String title = "FileMenu";
    String mneu = "FileMneu";
    JMenu fileMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu);
    title = "WB_IMPORT_CARDS_TO_DATASET";
    mneu = "WB_IMPORT_CARDS_MNEU";

    if (!isReadOnly) {
        JMenuItem importImagesMI = UIHelper.createLocalizedMenuItem(fileMenu, title, mneu, "", true, null);
        importImagesMI.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {

                importImages();
            }
        });
    }

    /*        title = "ImageFrame.CLOSE";
            mneu = "ImageFrame.CloseMneu";
            closeMI = UIHelper.createLocalizedMenuItem(fileMenu, title, mneu,  "", true, null);
            closeMI.addActionListener(new ActionListener()
            {
    public void actionPerformed(ActionEvent ae)
    {
        ImageFrame.this.setVisible(false);
    }
            });*/

    title = "ImageFrame.View";
    mneu = "ImageFrame.ViewMneu";
    viewMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu);
    reduceMI = UIHelper.createRadioButtonMenuItem(viewMenu, "WB_REDUCED_SIZE", "ImageFrame.ReducedSizeMneu", "",
            true, null);
    reduceMI.setSelected(true);
    reduceMI.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (row == null) {
                return;
            }

            // simply 'remember' that we want to show reduced images for this row
            rowToImageSizeHash.put(row.hashCode(), REDUCED_SIZE);
            // then 'reshow' the current image
            showImage();
        }
    });

    origMI = UIHelper.createRadioButtonMenuItem(viewMenu, "WB_ORIG_SIZE", "ImageFrame.OrigMneu", "", true,
            null);
    origMI.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (row == null) {
                return;
            }

            // simply 'remember' that we want to show fill size images for this row
            rowToImageSizeHash.put(row.hashCode(), FULL_SIZE);
            // then 'reshow' the current image
            showImage();
        }
    });

    ButtonGroup btnGrp = new ButtonGroup();
    btnGrp.add(reduceMI);
    btnGrp.add(origMI);

    viewMenu.addSeparator();

    alwaysOnTopMI = UIHelper.createCheckBoxMenuItem(viewMenu, "WB_ALWAYS_ON_TOP", null, "", true, null);
    alwaysOnTopMI.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            ImageFrame.this.setAlwaysOnTop(alwaysOnTopMI.isSelected());
        }
    });

    addPropertyChangeListener("alwaysOnTop", this);

    if (!isReadOnly) {
        ActionListener deleteImg = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                deleteImage();
            }
        };

        ActionListener replaceImg = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                replaceImage();
            }
        };

        ActionListener addImg = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                addImages();
            }
        };

        title = "ImageFrame.Image";
        mneu = "ImageFrame.ImageMneu";
        imageMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu);

        title = "WB_ADD_IMG";
        mneu = "WB_ADD_IMG_MNEM";
        addMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, addImg);

        title = "WB_REPLACE_IMG";
        mneu = "WB_REPLACE_IMG_MNEU";
        replaceMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, replaceImg);

        title = "WB_DEL_IMG_LINK";
        mneu = "WB_DEL_IMG_LINK_MNEU";
        deleteMI = UIHelper.createLocalizedMenuItem(imageMenu, title, mneu, "", true, deleteImg);

        loadImgBtn.addActionListener(addImg);
    }

    JMenu helpMenu = new JMenu(getResourceString("HELP"));
    menuBar.add(HelpMgr.createHelpMenuItem(helpMenu, getResourceString("WB_IMAGE_WINDOW")));

    enableMenus(false);

    setJMenuBar(menuBar);

    pack();

    HelpMgr.setHelpID(this, "WorkbenchWorkingWithImages");
}

From source file:org.cds06.speleograph.graph.SeriesMenu.java

private JPopupMenu createPopupMenuForSeries(final Series series) {

    if (series == null)
        return new JPopupMenu();

    final JPopupMenu menu = new JPopupMenu(series.getName());

    menu.removeAll();/*from  w w  w  .  jav a  2s  . co m*/

    menu.add(new AbstractAction() {
        {
            putValue(NAME, "Renommer la srie");
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            menu.setVisible(false);
            String newName = "";
            while (newName == null || newName.equals("")) {
                newName = (String) JOptionPane.showInputDialog(application,
                        "Entrez un nouveau nom pour la srie", null, JOptionPane.QUESTION_MESSAGE, null, null,
                        series.getName());
            }
            series.setName(newName);
        }
    });

    if (series.hasOwnAxis()) {
        menu.add(new AbstractAction() {

            {
                putValue(NAME, "Supprimer l'axe spcifique");
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                if (JOptionPane.showConfirmDialog(application, "tes vous sr de vouloir supprimer cet axe ?",
                        "Confirmation", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
                    series.setAxis(null);
                }
            }
        });
    } else {
        menu.add(new JMenuItem(new AbstractAction() {

            {
                putValue(NAME, "Crer un axe spcifique pour la srie");
            }

            @Override
            public void actionPerformed(ActionEvent e) {
                String name = JOptionPane.showInputDialog(application, "Quel titre pour cet axe ?",
                        series.getAxis().getLabel());
                if (name == null || "".equals(name))
                    return; // User has canceled
                series.setAxis(new NumberAxis(name));
            }
        }));
    }

    menu.add(new SetTypeMenu(series));

    if (series.isWater()) {
        menu.addSeparator();
        menu.add(new SumOnPeriodAction(series));
        menu.add(new CreateCumulAction(series));
    }
    if (series.isWaterCumul()) {
        menu.addSeparator();
        menu.add(new SamplingAction(series));
    }

    if (series.isPressure()) {
        menu.addSeparator();
        menu.add(new CorrelateAction(series));
        menu.add(new WaterHeightAction(series));
    }

    menu.addSeparator();

    menu.add(new AbstractAction() {
        {
            String name;
            if (series.canUndo())
                name = "Annuler " + series.getItemsName();
            else
                name = series.getLastUndoName();

            putValue(NAME, name);

            if (series.canUndo())
                setEnabled(true);
            else {
                setEnabled(false);
            }

        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.undo();
        }
    });

    menu.add(new AbstractAction() {
        {
            String name;
            if (series.canRedo()) {
                name = "Refaire " + series.getNextRedoName();
                setEnabled(true);
            } else {
                name = series.getNextRedoName();
                setEnabled(false);
            }

            putValue(NAME, name);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.redo();
        }
    });

    menu.add(new AbstractAction() {
        {
            putValue(NAME, I18nSupport.translate("menus.serie.resetSerie"));
            if (series.canUndo())
                setEnabled(true);
            else
                setEnabled(false);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            series.reset();
        }
    });

    menu.add(new LimitDateRangeAction(series));

    menu.add(new HourSettingAction(series));

    menu.addSeparator();

    {
        JMenuItem deleteItem = new JMenuItem("Supprimer la srie");
        deleteItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (JOptionPane.showConfirmDialog(application,
                        "tes-vous sur de vouloir supprimer cette srie ?\n"
                                + "Cette action est dfinitive.",
                        "Confirmation", JOptionPane.OK_CANCEL_OPTION,
                        JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
                    series.delete();
                }
            }
        });
        menu.add(deleteItem);
    }

    menu.addSeparator();

    {
        final JMenuItem up = new JMenuItem("Remonter dans la liste"),
                down = new JMenuItem("Descendre dans la liste");
        ActionListener listener = new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (e.getSource().equals(up)) {
                    series.upSeriesInList();
                } else {
                    series.downSeriesInList();
                }
            }
        };
        up.addActionListener(listener);
        down.addActionListener(listener);
        if (series.isFirst()) {
            menu.add(down);
        } else if (series.isLast()) {
            menu.add(up);
        } else {
            menu.add(up);
            menu.add(down);
        }
    }

    menu.addSeparator();

    {
        menu.add(new SeriesInfoAction(series));
    }

    {
        JMenuItem colorItem = new JMenuItem("Couleur de la srie");
        colorItem.addActionListener(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                series.setColor(JColorChooser.showDialog(application,
                        I18nSupport.translate("actions.selectColorForSeries"), series.getColor()));
            }
        });
        menu.add(colorItem);
    }

    {
        JMenu plotRenderer = new JMenu("Affichage de la srie");
        final ButtonGroup modes = new ButtonGroup();
        java.util.List<DrawStyle> availableStyles;
        if (series.isMinMax()) {
            availableStyles = DrawStyles.getDrawableStylesForHighLow();
        } else {
            availableStyles = DrawStyles.getDrawableStyles();
        }
        for (final DrawStyle s : availableStyles) {
            final JRadioButtonMenuItem item = new JRadioButtonMenuItem(DrawStyles.getHumanCheckboxText(s));
            item.addChangeListener(new ChangeListener() {
                @Override
                public void stateChanged(ChangeEvent e) {
                    if (item.isSelected())
                        series.setStyle(s);
                }
            });
            modes.add(item);
            if (s.equals(series.getStyle())) {
                modes.setSelected(item.getModel(), true);
            }
            plotRenderer.add(item);
        }
        menu.add(plotRenderer);
    }
    menu.addSeparator();

    menu.add(new AbstractAction() {
        {
            putValue(Action.NAME, "Fermer le fichier");
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            if (JOptionPane.showConfirmDialog(application,
                    "tes-vous sur de vouloir fermer toutes les sries du fichier ?", "Confirmation",
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) {
                final File f = series.getOrigin();
                for (final Series s : Series.getInstances().toArray(new Series[Series.getInstances().size()])) {
                    if (s.getOrigin().equals(f))
                        s.delete();
                }
            }
        }
    });

    return menu;
}

From source file:net.sf.firemox.Magic.java

/**
 * Creates new form Magic//from  w  ww.  j  a va 2  s  .c  o m
 */
private Magic() {
    super();
    initComponents();

    // list all installed Look&Feel
    UIListener uiListener = new UIListener();
    UIManager.LookAndFeelInfo[] uimTMP = UIManager.getInstalledLookAndFeels();
    final List<Pair<String, String>> lfList = new ArrayList<Pair<String, String>>();
    for (LookAndFeelInfo lookAndFeel : uimTMP) {
        Pair<String, String> info = new Pair<String, String>(lookAndFeel.getName(), lookAndFeel.getClassName());
        if (!lfList.contains(info)) {
            lfList.add(info);
        }
    }

    // list all SkinLF themes
    final File[] themes = MToolKit.getFile("lib").listFiles(new FileFilter() {
        public boolean accept(File f) {
            return f != null && f.getName().endsWith(".zip");
        }
    });

    int maxIndex = Configuration.getConfiguration().getMaxIndex("themes.skinlf.caches.cache");
    List<Pair<String, String>> knownThemes = new ArrayList<Pair<String, String>>();
    for (int i = 0; i < maxIndex + 1; i++) {
        String file = Configuration.getConfiguration()
                .getString("themes.skinlf.caches.cache(" + i + ").[@file]");
        int index = ArrayUtils.indexOf(themes, MToolKit.getFile(file));
        if (index >= 0) {
            themes[index] = null;
            Pair<String, String> skin = new Pair<String, String>(
                    Configuration.getConfiguration().getString("themes.skinlf.caches.cache(" + i + ").[@name]"),
                    file);
            knownThemes.add(skin);
            lfList.add(skin);
        }
    }

    for (File theme : themes) {
        if (theme != null) {
            // a new theme --> will be cached
            try {
                final List<Node> properties = new XmlParser().parse(new ZipResourceLoader(theme.toURI().toURL())
                        .getResourceAsStream("skinlf-themepack.xml")).getNodes("property");
                PROPERTIES: for (int j = 0; j < properties.size(); j++) {
                    if ("skin.name".equals(properties.get(j).getAttribute("name"))) {
                        // skin name found
                        String relativePath = MToolKit.getRelativePath(theme.getCanonicalPath());
                        Pair<String, String> skin = new Pair<String, String>(
                                properties.get(j).getAttribute("value"), "zip:" + relativePath);
                        lfList.add(skin);
                        knownThemes.add(new Pair<String, String>(properties.get(j).getAttribute("value"),
                                relativePath));
                        break PROPERTIES;
                    }
                }
            } catch (Exception e) {
                Log.error("Error in " + theme, e);
            }
        }
    }

    Configuration.getConfiguration().clearProperty("themes.skinlf.caches");
    for (int index = 0; index < knownThemes.size(); index++) {
        Pair<String, String> skin = knownThemes.get(index);
        Configuration.getConfiguration().setProperty("themes.skinlf.caches.cache(" + index + ").[@name]",
                skin.key);
        Configuration.getConfiguration().setProperty("themes.skinlf.caches.cache(" + index + ").[@file]",
                skin.value);
    }

    // create look and feel menu items
    Collections.sort(lfList);
    lookAndFeels = new JRadioButtonMenuItem[lfList.size() + 1];
    ButtonGroup group5 = new ButtonGroup();
    for (int i = 0; i < lfList.size(); i++) {
        final String lfName = lfList.get(i).key;
        final String lfClassName = lfList.get(i).value;
        lookAndFeels[i] = new JRadioButtonMenuItem(lfName);
        if (lookAndFeelName.equalsIgnoreCase(lfClassName)) {
            // this the current l&f
            lookAndFeels[i].setSelected(true);
        }
        if (!SkinLF.isSkinLF(lfClassName)) {
            lookAndFeels[i].setEnabled(MToolKit.isAvailableLookAndFeel(lfClassName));
        }
        group5.add(lookAndFeels[i]);
        lookAndFeels[i].setActionCommand(lfClassName);
        themeMenu.add(lookAndFeels[i], i);
        lookAndFeels[i].addActionListener(uiListener);
    }
    lfList.clear();

    initialdelayMenu.addActionListener(this);
    dismissdelayMenu.addActionListener(this);

    ConnectionManager.enableConnectingTools(false);

    // read auto mana option
    MCommonVars.autoMana = Configuration.getBoolean("automana", true);
    autoManaMenu.setSelected(MCommonVars.autoMana);

    // Force to initialize the TBS settings
    MToolKit.tbsName = null;
    setMdb(Configuration.getString("lastTBS", IdConst.TBS_DEFAULT));

    // set the autoStack mode
    MCommonVars.autoStack = Configuration.getBoolean("autostack", false);
    autoPlayMenu.setSelected(MCommonVars.autoStack);

    // read maximum displayed colored mana in context
    PayMana.thresholdColored = Configuration.getInt("threshold-colored", 6);

    ZoneManager.updateLookAndFeel();

    // pack this frame
    pack();

    // Maximize this frame
    setExtendedState(Frame.MAXIMIZED_BOTH);

    if (batchMode != -1) {

        final String deckFile = Configuration.getString(Configuration.getString("decks.deck(0)"));
        try {
            Deck batchDeck = DeckReader.getDeck(this, deckFile);
            switch (batchMode) {
            case BATCH_SERVER:
                ConnectionManager.server = new Server(batchDeck, null);
                ConnectionManager.server.start();
                break;
            case BATCH_CLIENT:
                ConnectionManager.client = new Client(batchDeck, null);
                ConnectionManager.client.start();
                break;
            default:
            }
        } catch (Throwable e) {
            throw new RuntimeException("Error in batch mode : ", e);
        }
    }
}

From source file:io.heming.accountbook.ui.MainFrame.java

private void initToolBar() {
    toolbar = new JToolBar("ToolBar", JToolBar.HORIZONTAL);

    // Add Button
    addButton = new JButton();
    addButton.setActionCommand("");
    addButton.setToolTipText("");
    addButton.setIcon(new ImageIcon(getClass().getResource("edit-add-3.png")));

    // Search date range radio buttons
    ButtonGroup group = new ButtonGroup();
    yearToggleButton = new JToggleButton();
    yearToggleButton.setToolTipText("");
    yearToggleButton.setIcon(new ImageIcon(getClass().getResource("year-s.png")));
    group.add(yearToggleButton);
    monthToggleButton = new JToggleButton();
    monthToggleButton.setToolTipText("");
    monthToggleButton.setIcon(new ImageIcon(getClass().getResource("month-s.png")));
    group.add(monthToggleButton);/*from www. ja va  2s .  co  m*/
    dayToggleButton = new JToggleButton();
    dayToggleButton.setToolTipText("");
    dayToggleButton.setIcon(new ImageIcon(getClass().getResource("day-s.png")));
    group.add(dayToggleButton);
    customToggleButton = new JToggleButton();
    customToggleButton.setToolTipText("");
    customToggleButton.setIcon(new ImageIcon(getClass().getResource("all-s.png")));
    group.add(customToggleButton);

    // ??Checkbox
    monthToggleButton.setSelected(true);

    Calendar earliestCalendar = Calendar.getInstance();
    earliestCalendar.add(Calendar.YEAR, -100);
    java.util.Date earliestDate = earliestCalendar.getTime();

    Calendar latestCalendar = Calendar.getInstance();
    latestCalendar.add(Calendar.YEAR, 100);
    java.util.Date latestDate = latestCalendar.getTime();
    // 3?
    Calendar calendar = Calendar.getInstance();
    calendar.add(Calendar.MONTH, -1);
    calendar.add(Calendar.DAY_OF_MONTH, 1);
    java.util.Date initDate = calendar.getTime();

    SpinnerDateModel startDateModel = new SpinnerDateModel(DateUtil.getStartOfWeek(), earliestDate, latestDate,
            Calendar.MONTH);
    startDateSpinner = new JSpinner(startDateModel);
    JSpinner.DateEditor startDateEditor = new JSpinner.DateEditor(startDateSpinner, "yyyy-MM-dd");
    startDateSpinner.setEditor(startDateEditor);

    calendar.add(Calendar.MONTH, 1);
    calendar.add(Calendar.DAY_OF_MONTH, -1);
    initDate = calendar.getTime();
    SpinnerDateModel endDateModel = new SpinnerDateModel(initDate, earliestDate, latestDate, Calendar.MONTH);
    endDateSpinner = new JSpinner(endDateModel);
    JSpinner.DateEditor endDateEditor = new JSpinner.DateEditor(endDateSpinner, "yyyy-MM-dd");
    endDateSpinner.setEditor(endDateEditor);

    // Keyword text field
    keywordTextField = new JTextField();
    keywordTextField.setPreferredSize(new Dimension(250, 20));
    keywordTextField.setMaximumSize(keywordTextField.getPreferredSize());

    // Search Button
    searchButton = new JButton();
    searchButton.setActionCommand("?");
    searchButton.setToolTipText("?");
    searchButton.setIcon(new ImageIcon(getClass().getResource("edit-find-5.png")));

    // Layout
    cards = new JPanel();
    cards.setLayout(new CardLayout());
    Box box = Box.createHorizontalBox();
    box.add(Box.createHorizontalGlue());

    startDateSpinner.setPreferredSize(new Dimension(90, 20));
    startDateSpinner.setMaximumSize(startDateSpinner.getPreferredSize());
    box.add(startDateSpinner);

    box.add(Box.createHorizontalStrut(6));

    endDateSpinner.setPreferredSize(new Dimension(90, 20));
    endDateSpinner.setMaximumSize(endDateSpinner.getPreferredSize());
    box.add(endDateSpinner);

    cards.add(new JPanel(), HIDE_DATE_CHOOSER);
    cards.add(box, SHOW_DATE_CHOOSER);

    Box dateRangeBox = Box.createHorizontalBox();
    dateRangeBox.add(Box.createHorizontalGlue());
    dateRangeBox.add(cards);

    toolbar.add(addButton);
    toolbar.add(dateRangeBox);
    toolbar.add(customToggleButton);
    toolbar.add(yearToggleButton);
    toolbar.add(monthToggleButton);
    toolbar.add(dayToggleButton);
    toolbar.add(keywordTextField);
    toolbar.add(searchButton);

    add(toolbar, BorderLayout.NORTH);

    // Event listener
    addButton.addActionListener(e -> showAddRecordDialog());

    ActionListener listener = e -> searchRecords();
    yearToggleButton.addActionListener(listener);
    monthToggleButton.addActionListener(listener);
    dayToggleButton.addActionListener(listener);
    customToggleButton.addActionListener(listener);
    keywordTextField.addActionListener(listener);
    searchButton.addActionListener(listener);

    customToggleButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e)) {
                chooseDateRange();
            }
        }
    });
}

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

private JMenu getSessionIssuerMenu(ButtonGroup buttonGroup) {

    JRadioButtonMenuItem mnuSiType = new JRadioButtonMenuItem("Type");
    JRadioButtonMenuItem mnuSiArn = new JRadioButtonMenuItem("Arn");
    JRadioButtonMenuItem mnuSiPrincipalId = new JRadioButtonMenuItem("Principal Id");
    JRadioButtonMenuItem mnuSiAccountId = new JRadioButtonMenuItem("Account Id");
    JRadioButtonMenuItem mnuSiUsername = new JRadioButtonMenuItem("Username");

    mnuSiType.setActionCommand("UserIdentity.SessionContext.SessionIssuer.Type");
    mnuSiType.addActionListener(this);

    mnuSiPrincipalId.setActionCommand("UserIdentity.SessionContext.SessionIssuer.PrincipalId");
    mnuSiPrincipalId.addActionListener(this);

    mnuSiArn.setActionCommand("UserIdentity.SessionContext.SessionIssuer.Arn");
    mnuSiArn.addActionListener(this);

    mnuSiAccountId.setActionCommand("UserIdentity.SessionContext.SessionIssuer.AccountId");
    mnuSiAccountId.addActionListener(this);

    mnuSiUsername.setActionCommand("UserIdentity.SessionContext.SessionIssuer.UserName");
    mnuSiUsername.addActionListener(this);

    buttonGroup.add(mnuSiType);
    buttonGroup.add(mnuSiPrincipalId);//from w  w  w .j  a  v  a 2 s. c o m
    buttonGroup.add(mnuSiArn);
    buttonGroup.add(mnuSiAccountId);
    buttonGroup.add(mnuSiUsername);

    JMenu siMenu = new JMenu("Session Issuer");
    siMenu.add(mnuSiType);
    siMenu.add(mnuSiPrincipalId);
    siMenu.add(mnuSiArn);
    siMenu.add(mnuSiAccountId);
    siMenu.add(mnuSiUsername);

    return siMenu;
}

From source file:components.DialogDemo.java

/** Creates the panel shown by the first tab. */
private JPanel createSimpleDialogBox() {
    final int numButtons = 4;
    JRadioButton[] radioButtons = new JRadioButton[numButtons];
    final ButtonGroup group = new ButtonGroup();

    JButton showItButton = null;//  w  ww.jav a2 s.c o  m

    final String defaultMessageCommand = "default";
    final String yesNoCommand = "yesno";
    final String yeahNahCommand = "yeahnah";
    final String yncCommand = "ync";

    radioButtons[0] = new JRadioButton("OK (in the L&F's words)");
    radioButtons[0].setActionCommand(defaultMessageCommand);

    radioButtons[1] = new JRadioButton("Yes/No (in the L&F's words)");
    radioButtons[1].setActionCommand(yesNoCommand);

    radioButtons[2] = new JRadioButton("Yes/No " + "(in the programmer's words)");
    radioButtons[2].setActionCommand(yeahNahCommand);

    radioButtons[3] = new JRadioButton("Yes/No/Cancel " + "(in the programmer's words)");
    radioButtons[3].setActionCommand(yncCommand);

    for (int i = 0; i < numButtons; i++) {
        group.add(radioButtons[i]);
    }
    radioButtons[0].setSelected(true);

    showItButton = new JButton("Show it!");
    showItButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String command = group.getSelection().getActionCommand();

            //ok dialog
            if (command == defaultMessageCommand) {
                JOptionPane.showMessageDialog(frame, "Eggs aren't supposed to be green.");

                //yes/no dialog
            } else if (command == yesNoCommand) {
                int n = JOptionPane.showConfirmDialog(frame, "Would you like green eggs and ham?",
                        "An Inane Question", JOptionPane.YES_NO_OPTION);
                if (n == JOptionPane.YES_OPTION) {
                    setLabel("Ewww!");
                } else if (n == JOptionPane.NO_OPTION) {
                    setLabel("Me neither!");
                } else {
                    setLabel("Come on -- tell me!");
                }

                //yes/no (not in those words)
            } else if (command == yeahNahCommand) {
                Object[] options = { "Yes, please", "No way!" };
                int n = JOptionPane.showOptionDialog(frame, "Would you like green eggs and ham?",
                        "A Silly Question", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,
                        options, options[0]);
                if (n == JOptionPane.YES_OPTION) {
                    setLabel("You're kidding!");
                } else if (n == JOptionPane.NO_OPTION) {
                    setLabel("I don't like them, either.");
                } else {
                    setLabel("Come on -- 'fess up!");
                }

                //yes/no/cancel (not in those words)
            } else if (command == yncCommand) {
                Object[] options = { "Yes, please", "No, thanks", "No eggs, no ham!" };
                int n = JOptionPane.showOptionDialog(frame,
                        "Would you like some green eggs to go " + "with that ham?", "A Silly Question",
                        JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options,
                        options[2]);
                if (n == JOptionPane.YES_OPTION) {
                    setLabel("Here you go: green eggs and ham!");
                } else if (n == JOptionPane.NO_OPTION) {
                    setLabel("OK, just the ham, then.");
                } else if (n == JOptionPane.CANCEL_OPTION) {
                    setLabel("Well, I'm certainly not going to eat them!");
                } else {
                    setLabel("Please tell me what you want!");
                }
            }
            return;
        }
    });

    return createPane(simpleDialogDesc + ":", radioButtons, showItButton);
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakListChartPanel.java

private JPopupMenu createPopupMenu(boolean over_peak) {

    JPopupMenu menu = new JPopupMenu();

    if (over_peak) {
        updatePeakActions();/*from w  ww  . jav  a 2  s .  co m*/

        ButtonGroup group = new ButtonGroup();
        if (shown_mslevel.equals("ms")) {
            for (GlycanAction a : theApplication.getPluginManager().getMsPeakActions()) {
                JRadioButtonMenuItem last = new JRadioButtonMenuItem(
                        new GlycanAction(a, "annotatepeaks", -1, "", this));

                menu.add(last);
                last.setSelected(a == ms_action);
                group.add(last);
            }
        } else {
            for (GlycanAction a : theApplication.getPluginManager().getMsMsPeakActions()) {
                JRadioButtonMenuItem last = new JRadioButtonMenuItem(
                        new GlycanAction(a, "annotatepeaks", -1, "", this));

                menu.add(last);
                last.setSelected(a == msms_action);
                group.add(last);
            }
        }
        menu.addSeparator();
    }

    menu.add(theActionManager.get("zoomnone"));
    menu.add(theActionManager.get("zoomin"));
    menu.add(theActionManager.get("zoomout"));

    return menu;
}

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);/*from ww  w  .  j a  v  a 2  s . c  om*/

    // the tools menu
    JMenu toolsMenu = new JMenu("Tools");
    JMenuItem configureGraphItem = new JMenuItem("Configure Graph...");
    configureGraphItem.addActionListener(new ActionListener() {
        /**
         * {@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;
}