Example usage for javax.swing ButtonGroup ButtonGroup

List of usage examples for javax.swing ButtonGroup ButtonGroup

Introduction

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

Prototype

public ButtonGroup() 

Source Link

Document

Creates a new ButtonGroup.

Usage

From source file:lab4.YouQuiz.java

private void updateAnswerForm() {
    contentPanel.answerPanel.removeAll();

    final Question question = questionsArray.get(questionIndex);

    switch (question.type) {
    case Question.QUESTION_TYPE_MULTIPLE_CHOICE:
    case Question.QUESTION_TYPE_TRUE_FALSE:
        JRadioButton radioButton;
        final ButtonGroup radioGroup = new ButtonGroup();

        for (int i = 0; i < ((MultipleChoiceQuestion) question).getChoices().size(); ++i) {
            radioButton = new JRadioButton(((MultipleChoiceQuestion) question).getChoices().get(i));
            radioButton.setFont(new Font("Consolas", Font.PLAIN, 20));
            radioGroup.add(radioButton);
            radioButton.setFocusable(false);
            contentPanel.answerPanel.add(radioButton);
        }// w ww.j a va 2  s. c om

        for (ActionListener al : contentPanel.checkButton.getActionListeners()) {
            contentPanel.checkButton.removeActionListener(al);
        }

        contentPanel.checkButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent event) {
                if (question.checkAnswer(getSelectedButtonText(radioGroup))) {
                    JOptionPane.showMessageDialog(null, "Thats Great, Correct Answer", "Excellent",
                            JOptionPane.INFORMATION_MESSAGE);
                } else {
                    JOptionPane.showMessageDialog(null,
                            "Oops! Wrong Answer. Its '" + question.getAnswer().get(0) + "'", "Sorry",
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        });

        break;
    case Question.QUESTION_TYPE_SHORT_ANSWER:
        final JTextField answerText = new JTextField(25);
        answerText.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 20));
        contentPanel.answerPanel.add(answerText);

        for (ActionListener al : contentPanel.checkButton.getActionListeners()) {
            contentPanel.checkButton.removeActionListener(al);
        }

        contentPanel.checkButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent event) {
                if (question.checkAnswer(answerText.getText())) {
                    JOptionPane.showMessageDialog(null, "Thats Great, Correct Answer", "Excellent",
                            JOptionPane.INFORMATION_MESSAGE);
                } else {
                    JOptionPane.showMessageDialog(null,
                            "Oops! Wrong Answer. Its '" + question.getAnswer().get(0) + "'", "Sorry",
                            JOptionPane.ERROR_MESSAGE);
                }
            }
        });

        break;
    }

    contentPanel.answerPanel.invalidate();
}

From source file:com.mirth.connect.client.ui.panels.connectors.PollingSettingsPanel.java

private void initComponents() {
    scheduleTypeLabel = new JLabel("Schedule Type:");
    scheduleTypeComboBox = new MirthComboBox();
    // @formatter:off
    scheduleTypeComboBox//from  w ww. j  ava  2  s.  c  o m
            .setToolTipText("<html>This connector polls to determine when new messages have arrived.<br>"
                    + "Select \"Interval\" to poll each n units of time.<br>"
                    + "Select \"Time\" to poll once a day at the specified time.<br>"
                    + "Select \"Cron\" to poll at the specified cron expression(s).</html>");
    // @formatter:on
    scheduleTypeComboBox.addItem(PollingType.INTERVAL.getDisplayName());
    scheduleTypeComboBox.addItem(PollingType.TIME.getDisplayName());
    scheduleTypeComboBox.addItem(PollingType.CRON.getDisplayName());

    scheduleTypeActionListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            scheduleTypeActionPerformed();
            updateNextFireTime();
        }
    };

    nextPollLabel = new JLabel("Next poll at: ");

    yesStartPollRadioButton = new MirthRadioButton("Yes");
    yesStartPollRadioButton.setToolTipText(
            "<html>Select Yes to immediately poll once on start.<br/>All subsequent polling will follow the specified schedule.</html>");
    yesStartPollRadioButton.setBackground(UIConstants.BACKGROUND_COLOR);
    yesStartPollRadioButton.setFocusable(false);

    noStartPollRadioButton = new MirthRadioButton("No");
    noStartPollRadioButton.setToolTipText(
            "<html>Select Yes to immediately poll once on start.<br/>All subsequent polling will follow the specified schedule.</html>");
    noStartPollRadioButton.setBackground(UIConstants.BACKGROUND_COLOR);
    noStartPollRadioButton.setSelected(true);
    noStartPollRadioButton.setFocusable(false);

    pollOnStartButtonGroup = new ButtonGroup();
    pollOnStartButtonGroup.add(yesStartPollRadioButton);
    pollOnStartButtonGroup.add(noStartPollRadioButton);

    pollingTimePicker = new MirthTimePicker();
    pollingTimePicker.setToolTipText("The time of day to poll.");
    pollingTimePicker.setVisible(false);
    JSpinner.DefaultEditor editor = (JSpinner.DefaultEditor) pollingTimePicker.getEditor();
    JTextField textField = editor.getTextField();
    textField.getDocument().addDocumentListener(new DocumentListener() {
        public void insertUpdate(DocumentEvent event) {
            updateNextFireTime();
        }

        public void removeUpdate(DocumentEvent e) {
        }

        public void changedUpdate(DocumentEvent e) {
        }
    });

    pollingFrequencySettingsPanel = new JPanel();
    pollingFrequencySettingsPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    pollingFrequencySettingsPanel.setVisible(true);

    pollingFrequencyField = new MirthTextField();
    pollingFrequencyField.setToolTipText(
            "<html>The specified repeating time interval.<br/>Units must be less than 24 hours of time<br/>when converted to milliseconds.</html>");
    pollingFrequencyField.setSize(new Dimension(200, 20));
    pollingFrequencyField.setDocument(new MirthFieldConstraints(0, false, false, true));
    pollingFrequencyField.getDocument().addDocumentListener(new DocumentListener() {

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

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

        @Override
        public void changedUpdate(DocumentEvent e) {
        }
    });

    pollingFrequencyTypeComboBox = new MirthComboBox();
    pollingFrequencyTypeComboBox.setToolTipText("The interval's unit of time.");
    pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_MILLISECONDS);
    pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_SECONDS);
    pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_MINUTES);
    pollingFrequencyTypeComboBox.addItem(POLLING_FREQUENCY_HOURS);
    pollingFrequencyTypeComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateNextFireTime();
        }
    });

    pollingCronSettingsPanel = new JPanel();
    pollingCronSettingsPanel.setBackground(UIConstants.BACKGROUND_COLOR);
    pollingCronSettingsPanel.setVisible(false);

    cronJobsTable = new MirthTable();
    Object[][] tableData = new Object[0][1];
    cronJobsTable.setModel(new RefreshTableModel(tableData, new String[] { "Expression", "Description" }));
    cronJobsTable.setOpaque(true);
    cronJobsTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    cronJobsTable.getTableHeader().setReorderingAllowed(false);
    cronJobsTable.setSortable(false);
    cronJobsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    cronJobsTable.getColumnModel().getColumn(0).setResizable(false);
    cronJobsTable.getColumnModel().getColumn(0).setCellEditor(new CronTableCellEditor(true));
    cronJobsTable.getColumnModel().getColumn(1).setResizable(false);
    cronJobsTable.getColumnModel().getColumn(1).setCellEditor(new CronTableCellEditor(true));

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR,
                UIConstants.BACKGROUND_COLOR);
        cronJobsTable.setHighlighters(highlighter);
    }

    HighlightPredicate errorHighlighterPredicate = new HighlightPredicate() {
        public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
            if (adapter.column == cronJobsTable.getColumnViewIndex("Expression")) {
                String cronExpression = (String) cronJobsTable.getValueAt(adapter.row, adapter.column);

                if (invalidExpressions.contains(cronExpression)) {
                    return true;
                }
            }
            return false;
        }
    };
    errorHighlighter = new ColorHighlighter(errorHighlighterPredicate, Color.PINK, Color.BLACK, Color.PINK,
            Color.BLACK);

    //@formatter:off
    String tooltip = "<html><head><style>td {text-align:center;}</style></head>"
            + "Cron expressions must be in Quartz format with at least 6 fields.<br/>" + "<br/>Format:"
            + "<table>" + "<tr><td>Field</td><td>Required</td><td>Values</td><td>Special Characters</td></tr>"
            + "<tr><td>Seconds</td><td>YES</td><td>0-59</td><td>, - * /</td></tr>"
            + "<tr><td>Minutes</td><td>YES</td><td>0-59</td><td>, - * /</td></tr>"
            + "<tr><td>Hours</td><td>YES</td><td>0-23</td><td>, - * /</td></tr>"
            + "<tr><td>Day of Month</td><td>YES</td><td>1-31</td><td>, - * ? / L W</td></tr>"
            + "<tr><td>Month</td><td>YES</td><td>1-12 or JAN-DEC</td><td>, - * /</td></tr>"
            + "<tr><td>Day of Week</td><td>YES</td><td>1-7 or SUN-SAT</td><td>, - * ? / L #</td></tr>"
            + "<tr><td>Year</td><td>NO</td><td>empty, 1970-2099</td><td>, - * /</td></tr>" + "</table>"
            + "<br/>Special Characters:" + "<br/> &nbsp <b>*</b> : all values"
            + "<br/> &nbsp <b>?</b> : no specific value" + "<br/> &nbsp <b>-</b> : used to specify ranges"
            + "<br/> &nbsp <b>,</b> : used to specify list of values"
            + "<br/> &nbsp <b>/</b> : used to specify increments"
            + "<br/> &nbsp <b>L</b> : used to specify the last of"
            + "<br/> &nbsp <b>W</b> : used to specify the nearest weekday"
            + "<br/> &nbsp <b>#</b> : used to specify the nth day of the month"
            + "<br/><br/>Example: 0 */5 8-17 * * ? means to fire every 5 minutes starting at 8am<br/>and ending at 5pm everyday"
            + "<br/><br/><b>Note:</b> Support for specifying both a day-of-week and day-of-month<br/>is not yet supported. A ? must be used in one of these fields.</html>";
    //@formatter:on
    cronJobsTable.setToolTipText(tooltip);
    cronJobsTable.getTableHeader().setToolTipText(tooltip);

    cronScrollPane = new JScrollPane();
    cronScrollPane.getViewport().add(cronJobsTable);

    addJobButton = new JButton("Add");
    addJobButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            ((DefaultTableModel) cronJobsTable.getModel()).addRow(new Vector<String>());

            int rowSelectionNumber = cronJobsTable.getRowCount() - 1;
            cronJobsTable.setRowSelectionInterval(rowSelectionNumber, rowSelectionNumber);
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);

            Boolean enabled = deleteJobButton.isEnabled();
            if (!enabled) {
                deleteJobButton.setEnabled(true);
            }
            updateNextFireTime();
        }
    });

    deleteJobButton = new JButton("Delete");
    deleteJobButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            int rowSelectionNumber = cronJobsTable.getSelectedRow();

            if (rowSelectionNumber > -1) {
                DefaultTableModel model = (DefaultTableModel) cronJobsTable.getModel();
                model.removeRow(rowSelectionNumber);

                rowSelectionNumber--;
                if (rowSelectionNumber > -1) {
                    cronJobsTable.setRowSelectionInterval(rowSelectionNumber, rowSelectionNumber);
                } else if (cronJobsTable.getRowCount() > 0) {
                    cronJobsTable.setRowSelectionInterval(0, 0);
                }

                if (cronJobsTable.getRowCount() == 0) {
                    deleteJobButton.setEnabled(false);
                }
            }

            updateNextFireTime();
            PlatformUI.MIRTH_FRAME.setSaveEnabled(true);
        }
    });
    deleteJobButton.setEnabled(false);

    advancedSettingsButton = new JButton(new ImageIcon(Frame.class.getResource("images/wrench.png")));
    advancedSettingsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            lastSelectedPollingType = StringUtils.isBlank(lastSelectedPollingType) ? "Interval"
                    : lastSelectedPollingType;
            new AdvancedPollingSettingsDialog(lastSelectedPollingType, cachedAdvancedConnectorProperties,
                    channelContext);
            updateNextFireTime();
        }
    });

    timeSettingsLabel = new JLabel("Interval:");
    timeSettingsLabel.setBackground(UIConstants.BACKGROUND_COLOR);

    scheduleSettingsPanel = new JPanel();
    scheduleSettingsPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    if (!channelContext) {
        // @formatter:off
        scheduleTypeComboBox.setToolTipText("<html>Select the pruning schedule type.<br>"
                + "Select \"Interval\" to prune each n units of time.<br>"
                + "Select \"Time\" to prune once a day at the specified time.<br>"
                + "Select \"Cron\" to prune at the specified cron expression(s).</html>");
        // @formatter:on 
        pollingFrequencyField.setToolTipText(
                "<html>The specified repeating time interval.<br/>Units must be between 1 and 24 hours of time<br/>when converted to milliseconds.</html>");
    }
}

From source file:com.t3.macro.api.functions.input.ColumnPanel.java

/** Creates a group of radio buttons. */
public JComponent createRadioControl(VarSpec vs) {
    int listIndex = vs.optionValues.getNumeric("SELECT");
    if (listIndex < 0 || listIndex >= vs.valueList.size())
        listIndex = 0;/*from   w  ww  . ja  va2  s .  co  m*/
    ButtonGroup bg = new ButtonGroup();
    Box box = (vs.optionValues.optionEquals("ORIENT", "H")) ? Box.createHorizontalBox()
            : Box.createVerticalBox();

    // If the prompt is suppressed by SPAN=TRUE, use it as the border title
    String title = "";
    if (vs.optionValues.optionEquals("SPAN", "TRUE"))
        title = vs.prompt;
    box.setBorder(new TitledBorder(new EtchedBorder(), title));

    int radioCount = 0;
    for (String value : vs.valueList) {
        JRadioButton radio = new JRadioButton(value, false);
        bg.add(radio);
        box.add(radio);
        if (listIndex == radioCount)
            radio.setSelected(true);
        radioCount++;
    }
    return box;
}

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

private JPopupMenu createPopupMenu(boolean over_peak) {

    JPopupMenu menu = new JPopupMenu();

    if (over_peak) {
        updatePeakActions();/*w  w w  . j ava  2 s.c o 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:ffx.ui.MainMenu.java

/**
 * <p>/*from   w  w w. j av a  2  s  .  c  om*/
 * Constructor for MainMenu.</p>
 *
 * @param f a {@link ffx.ui.MainPanel} object.
 */
public MainMenu(MainPanel f) {

    // Create the Tool Bar
    toolBar = new JToolBar("Toolbar", JToolBar.HORIZONTAL);
    toolBar.setBorderPainted(true);
    toolBar.setRollover(true);
    JButton temp = new JButton();
    insets = temp.getInsets();
    insets.set(2, 2, 2, 2);

    mainPanel = f;
    graphics = mainPanel.getGraphics3D();
    locale = mainPanel.getFFXLocale();
    loader = getClass().getClassLoader();
    blankIcon = new ImageIcon(loader.getResource(icons + "blank.gif"));

    String value = System.getProperty("structures", "false").trim();
    try {
        includeStructureMenu = Boolean.parseBoolean(value);
    } catch (Exception e) {
        includeStructureMenu = false;
    }

    /**
     * Main Menubar
     */
    JMenu fileMenu = addMenu("File", 'F');
    JMenu selectionMenu = addMenu("Selection", 'E');
    JMenu structureMenu = null;
    if (includeStructureMenu) {
        structureMenu = addMenu("Structure", 'S');
    }
    JMenu displayMenu = addMenu("Display", 'D');
    JMenu colorMenu = addMenu("Color", 'C');
    JMenu optionsMenu = addMenu("Options", 'O');
    JMenu pickingMenu = addMenu("Picking", 'P');
    JMenu trajectoryMenu = addMenu("Trajectory", 'T');
    JMenu exportMenu = addMenu("Export", 'X');
    JMenu windowMenu = addMenu("Window", 'W');
    JMenu helpMenu = addMenu("Help", 'H');

    /**
     * File Menu - Events Handled by the MainPanel Class.
     */
    addMenuItem(fileMenu, icons + "folder_page", "Open", 'O', KeyEvent.VK_O, mainPanel);
    addMenuItem(fileMenu, icons + "disk", "SaveAs", 'S', KeyEvent.VK_S, mainPanel);
    addMenuItem(fileMenu, icons + "cancel", "Close", 'C', -1, mainPanel);
    addMenuItem(fileMenu, "BLANK", "CloseAll", 'A', -1, mainPanel);
    fileMenu.addSeparator();
    addMenuItem(fileMenu, icons + "drive_web", "DownloadFromPDB", 'D', KeyEvent.VK_D, mainPanel);
    fileMenu.addSeparator();
    addMenuItem(fileMenu, "BLANK", "ChooseKeyFile", 'R', -1, mainPanel);
    addMenuItem(fileMenu, "BLANK", "ChooseLogFile", 'I', -1, mainPanel);
    addMenuItem(fileMenu, "BLANK", "LoadRestartData", 'R', -1, mainPanel);
    if (!SystemUtils.IS_OS_MAC_OSX) {
        fileMenu.addSeparator();
        addMenuItem(fileMenu, "BLANK", "Exit", 'E', KeyEvent.VK_Q, mainPanel);
    }
    toolBar.addSeparator();

    /**
     * Selection Menu - Events Handled by the MainPanel and GraphicsCanvas.
     */
    addMenuItem(selectionMenu, icons + "add", "SelectAll", 'A', KeyEvent.VK_A, mainPanel);
    addMenuItem(selectionMenu, "BLANK", "RestrictToSelections", 'R', -1, graphics);
    addMenuItem(selectionMenu, icons + "arrow_merge", "MergeSelections", 'M', -1, mainPanel);
    selectionMenu.addSeparator();
    highlightCBMI = addCBMenuItem(selectionMenu, icons + "asterisk_yellow", "HighlightSelections", 'H',
            KeyEvent.VK_H, mainPanel);
    addMenuItem(selectionMenu, "BLANK", "SetSelectionColor", 'S', -1, graphics);
    selectionMenu.addSeparator();
    labelAtomsMI = addCBMenuItem(selectionMenu, "BLANK", "LabelSelectedAtoms", 'O', -1, graphics);
    labelResiduesMI = addCBMenuItem(selectionMenu, "BLANK", "LabelSelectedResidues", 'R', -1, graphics);
    addMenuItem(selectionMenu, "BLANK", "SetLabelFontSize", 'Z', -1, graphics);
    addMenuItem(selectionMenu, "BLANK", "SetLabelFontColor", 'C', -1, graphics);
    highlightCBMI.setSelected(false);
    labelAtomsMI.setSelected(false);
    labelResiduesMI.setSelected(false);
    toolBar.addSeparator();

    /**
     * Structure Menu - Events Handled by the MainPanel.
     */
    if (includeStructureMenu) {
        // Locate a jar file that has PDB Structures.
        String file = "ffx/xray/structures/1N7S.pdb";
        addMenuItem(structureMenu, "BLANK", file, '.', -1, mainPanel);
    }

    /**
     * Display Menu - Events handled by the GraphicsCanvas.
     */
    addMenuItem(displayMenu, "BLANK", "Wireframe", 'W', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "Tube", 'T', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "Spacefill", 'S', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "BallAndStick", 'B', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "Invisible", 'I', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "RMIN", 'R', -1, graphics);
    displayMenu.addSeparator();
    addMenuItem(displayMenu, "BLANK", "ShowHydrogens", 'H', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "HideHydrogens", 'Y', -1, graphics);
    displayMenu.addSeparator();
    addMenuItem(displayMenu, "BLANK", "Fill", 'F', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "Points", 'P', -1, graphics);
    addMenuItem(displayMenu, "BLANK", "Lines", 'I', -1, graphics);
    displayMenu.addSeparator();
    addMenuItem(displayMenu, "BLANK", "Preferences", 'P', -1, graphics);

    /**
     * Color Menu - Events handled by the GraphicsCanvas.
     */
    addMenuItem(colorMenu, "BLANK", "Monochrome", 'M', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "CPK", 'C', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "Residue", 'R', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "Structure", 'S', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "Polymer", 'M', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "PartialCharge", 'P', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "UserColor", 'U', -1, graphics);
    colorMenu.addSeparator();
    addMenuItem(colorMenu, "BLANK", "ApplyUserColor", 'A', -1, graphics);
    addMenuItem(colorMenu, "BLANK", "SetUserColor", 'C', -1, graphics);

    /**
     * Options Menu - Events handled by the GraphicsCanvas.
     */
    dragModeButtonGroup = new ButtonGroup();
    activeRBMI = addBGMI(dragModeButtonGroup, optionsMenu, "BLANK", "ActiveSystem", 'A', KeyEvent.VK_A,
            graphics);
    mouseRBMI = addBGMI(dragModeButtonGroup, optionsMenu, "BLANK", "SystemBelowMouse", 'S', KeyEvent.VK_M,
            graphics);
    activeRBMI.setSelected(true);
    optionsMenu.addSeparator();
    JMenu leftMouseMenu = addSubMenu(optionsMenu, "LeftMouseButton", 'M');
    leftMouseButtonGroup = new ButtonGroup();
    rotateRBMI = addBGMI(leftMouseButtonGroup, leftMouseMenu, "BLANK", "Rotate", 'R', KeyEvent.VK_R, graphics);
    addBGMI(leftMouseButtonGroup, leftMouseMenu, "BLANK", "Translate", 'T', KeyEvent.VK_T, graphics);
    addBGMI(leftMouseButtonGroup, leftMouseMenu, "BLANK", "Zoom", 'Z', KeyEvent.VK_Z, graphics);
    rotateRBMI.setSelected(true);
    optionsMenu.addSeparator();
    addMenuItem(optionsMenu, "BLANK", "RotateAboutCenter", 'C', KeyEvent.VK_C, graphics);
    addMenuItem(optionsMenu, "BLANK", "RotateAboutPick", 'P', KeyEvent.VK_P, graphics);
    addMenuItem(optionsMenu, "BLANK", "ResetRotation", 'R', -1, graphics);
    addMenuItem(optionsMenu, "BLANK", "ResetTranslation", 'T', -1, graphics);
    addMenuItem(optionsMenu, icons + "arrow_refresh", "ResetRotationAndTranslation", 'E', -1, graphics);
    optionsMenu.addSeparator();
    addMenuItem(optionsMenu, icons + "magnifier_zoom_in", "ZoomIn", 'I', -1, graphics);
    addMenuItem(optionsMenu, icons + "magnifier_zoom_out", "ZoomOut", 'O', -1, graphics);
    addMenuItem(optionsMenu, "BLANK", "ResetGlobalZoom", 'Z', -1, graphics);
    addMenuItem(optionsMenu, "BLANK", "ResetGlobalRotation", 'N', -1, graphics);
    addMenuItem(optionsMenu, "BLANK", "ResetGlobalTranslation", 'O', -1, graphics);
    addMenuItem(optionsMenu, icons + "house", "ResetGlobalView", 'V', -1, graphics);
    optionsMenu.addSeparator();
    addMenuItem(optionsMenu, "BLANK", "SetBackgroundColor", 'B', -1, graphics);
    toolBar.addSeparator();

    /**
     * Picking Menu - Events handled by the GraphicsCanvas.
     */
    levelBG = new ButtonGroup();
    pickingCBMI = addCBMenuItem(pickingMenu, icons + "wand", "GraphicsPicking", 'G', KeyEvent.VK_0, graphics);
    pickingCBMI.setSelected(false);
    pickingMenu.addSeparator();
    atomRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickAtom", 'A', KeyEvent.VK_1, graphics);
    bondRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickBond", 'B', KeyEvent.VK_2, graphics);
    angleRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickAngle", 'N', KeyEvent.VK_3, graphics);
    dihedralRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickDihedral", 'D', KeyEvent.VK_4, graphics);
    residueRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickResidue", 'R', KeyEvent.VK_5, graphics);
    polymerRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickPolymer", 'P', KeyEvent.VK_6, graphics);
    moleculeRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickMolecule", 'M', KeyEvent.VK_7, graphics);
    systemRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "PickSystem", 'S', KeyEvent.VK_8, graphics);
    pickingMenu.addSeparator();
    measureDistanceRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "MeasureDistance", 'I', -1, graphics);
    measureAngleRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "MeasureAngle", 'L', -1, graphics);
    measureDihedralRBMI = addBGMI(levelBG, pickingMenu, "BLANK", "MeasureDihedral", 'H', -1, graphics);
    atomRBMI.setSelected(true);
    pickingMenu.addSeparator();
    addMenuItem(pickingMenu, "BLANK", "SetGraphicsPickingColor", 'S', -1, graphics);
    toolBar.addSeparator();

    /**
     * Trajectory Menu - Events handled by the MainPanel.
     */
    oscillateCBMI = addCBMenuItem(trajectoryMenu, icons + "control_repeat_blue", "Oscillate", 'O', -1,
            mainPanel);
    oscillateCBMI.setSelected(false);
    addMenuItem(trajectoryMenu, "BLANK", "Frame", 'A', -1, mainPanel);
    addMenuItem(trajectoryMenu, "BLANK", "Speed", 'E', -1, mainPanel);
    addMenuItem(trajectoryMenu, "BLANK", "Skip", 'K', -1, mainPanel);
    trajectoryMenu.addSeparator();
    addMenuItem(trajectoryMenu, icons + "control_play_blue", "Play", 'P', -1, mainPanel);
    addMenuItem(trajectoryMenu, icons + "control_stop_blue", "Stop", 'S', -1, mainPanel);
    addMenuItem(trajectoryMenu, icons + "control_fastforward_blue", "StepForward", 'F', -1, mainPanel);
    addMenuItem(trajectoryMenu, icons + "control_rewind_blue", "StepBack", 'B', -1, mainPanel);
    addMenuItem(trajectoryMenu, icons + "control_start_blue", "Reset", 'R', -1, mainPanel);
    toolBar.addSeparator();

    /**
     * Export Menu - Events handled by the GraphicsCanvas.
     */
    addMenuItem(exportMenu, icons + "camera", "CaptureGraphics", 'C', KeyEvent.VK_G, graphics);
    exportMenu.addSeparator();
    captureFormatButtonGroup = new ButtonGroup();
    addBGMI(captureFormatButtonGroup, exportMenu, "BLANK", "PNG", 'P', -1, graphics).setSelected(true);
    addBGMI(captureFormatButtonGroup, exportMenu, "BLANK", "JPEG", 'J', -1, graphics);
    addBGMI(captureFormatButtonGroup, exportMenu, "BLANK", "BMP", 'B', -1, graphics);
    addBGMI(captureFormatButtonGroup, exportMenu, "BLANK", "WBMP", 'W', -1, graphics);
    addBGMI(captureFormatButtonGroup, exportMenu, "BLANK", "GIF", 'G', -1, graphics);
    toolBar.addSeparator();

    /**
     * Window Menu - Events handled by the GraphicsCanvas.
     */
    addMenuItem(windowMenu, icons + "application_home", "ResetPanes", 'R', -1, mainPanel);
    addMenuItem(windowMenu, icons + "application_osx_terminal", "ResetConsole", 'L', -1, mainPanel);
    windowMenu.addSeparator();
    addMenuItem(windowMenu, icons + "application_side_contract", "ExpandGraphicsWindow", 'E', -1, mainPanel);
    addMenuItem(windowMenu, icons + "application_side_expand", "ShrinkGraphicsWindow", 'L', -1, mainPanel);
    windowMenu.addSeparator();
    systemsCBMI = addCBMenuItem(windowMenu, "BLANK", "ShowTree", 'T', -1, mainPanel);
    toolBarCBMI = addCBMenuItem(windowMenu, "BLANK", "ShowToolBar", 'B', -1, mainPanel);
    globalAxisCBMI = addCBMenuItem(windowMenu, "BLANK", "ShowGlobalAxes", 'C', -1, mainPanel);
    globalAxisCBMI.setSelected(true);
    toolBar.addSeparator();

    /**
     * Help Menu - Events handled by the MainPanel.
     */
    Action a = addMenuItem(helpMenu, icons + "help", "HelpContents", 'H', KeyEvent.VK_HELP, mainPanel);
    /**
     * Fix the ACCELERATOR_KEY for the Help menu item; no modifiers will be
     * used.
     */
    a.putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_HELP, 0));

    addMenuItem(helpMenu, "BLANK", "About", 'A', -1, mainPanel);

}

From source file:carolina.pegaLatLong.LatLong.java

private void btnGerarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGerarActionPerformed
    // TODO add your handling code here:
    List<JRadioButton> radios = new ArrayList<>();
    JPanel painel = new JPanel();
    JRadioButton btnEncontrados = new JRadioButton("Encontrados \n");
    JRadioButton btnNaoEncontrados = new JRadioButton("No encontrados");
    JRadioButton btnEncontradosMais = new JRadioButton("Mais de um encontrados");
    JRadioButton btnTudo = new JRadioButton("Tudo");
    ButtonGroup btnGroup = new ButtonGroup();
    btnGroup.add(btnTudo);//from  ww  w.j a v  a 2  s  . c o  m
    btnGroup.add(btnEncontrados);
    btnGroup.add(btnNaoEncontrados);
    btnGroup.add(btnEncontradosMais);

    //painel.add(btnTudo);
    painel.add(btnEncontrados);
    painel.add(btnNaoEncontrados);
    painel.add(btnEncontradosMais);
    JOptionPane.showMessageDialog(null, painel, "Escolha uma opo:", JOptionPane.QUESTION_MESSAGE);
    if (btnTudo.isSelected()) {
        System.err.println("Tudo selecionado!");
    } else if (btnNaoEncontrados.isSelected()) {
        System.err.println("No encontrados!");
    } else if (btnEncontrados.isSelected()) {
        try {
            geraCsv(listaResultado);
        } catch (IOException ex) {
            Logger.getLogger(LatLong.class.getName()).log(Level.SEVERE, null, ex);
        }
    } else if (btnEncontradosMais.isSelected()) {
        System.err.println("Encontrados mais");
    }

}

From source file:edu.ucla.stat.SOCR.applications.demo.PortfolioApplication2.java

public void addRadioButton2Left(String text, String toolTipText, String[] bValues, int defaultIndex,
        ActionListener l) {/*from ww  w  .j  a  v a 2s . c om*/

    JPanel in = new JPanel();

    in.add(Box.createVerticalGlue());
    in.add(new JLabel(text));
    ButtonGroup group = new ButtonGroup();

    rButtons = new JRadioButton[bValues.length];
    for (int i = 0; i < bValues.length; i++) {
        rButtons[i] = new JRadioButton(bValues[i]);
        rButtons[i].setName(bValues[i]);
        rButtons[i].addActionListener(l);
        rButtons[i].setActionCommand(bValues[i]);
        in.add(rButtons[i]);
        group.add(rButtons[i]);
        if (defaultIndex == i)
            rButtons[i].setSelected(true);
    }

    leftControl.add(in);
}

From source file:com.att.aro.ui.view.menu.datacollector.DeviceDialogOptions.java

private void loadRadioGroupVideo() {
    txtLREZ = ResourceBundleHelper.getMessageString("dlog.collector.option.video.orig");
    txtHDEF = ResourceBundleHelper.getMessageString("dlog.collector.option.video.hdef");
    txtSDEF = ResourceBundleHelper.getMessageString("dlog.collector.option.video.sdef");
    txtNONE = ResourceBundleHelper.getMessageString("dlog.collector.option.video.none");

    btn_lrez = new JRadioButton(txtLREZ);
    btn_hdef = new JRadioButton(txtHDEF);
    btn_sdef = new JRadioButton(txtSDEF);
    btn_none = new JRadioButton(txtNONE);

    btn_lrez.addActionListener(this);
    btn_hdef.addActionListener(this);
    btn_sdef.addActionListener(this);
    btn_none.addActionListener(this);

    ButtonGroup radioBtnVideo = new ButtonGroup();
    radioBtnVideo.add(btn_lrez);//from  w ww  .  j ava  2  s  .  co  m
    radioBtnVideo.add(btn_hdef);
    radioBtnVideo.add(btn_sdef);
    radioBtnVideo.add(btn_none);

}

From source file:de.dfki.owlsmx.gui.ResultVisualization.java

private void initComponents() {
    graphLabel = new javax.swing.JLabel();
    save = new javax.swing.JButton();
    logo = new javax.swing.JLabel();
    showAQRT = new javax.swing.JRadioButton();
    showRP = new javax.swing.JRadioButton();
    showMemory = new javax.swing.JRadioButton();
    launch = new javax.swing.JButton();
    show = new javax.swing.JButton();
    showGraph = new ButtonGroup();
    showGraph.add(showAQRT);//from w w  w  . j a va 2  s.c  o  m
    showGraph.add(showRP);
    showGraph.add(showMemory);
    //        showWindow = new javax.swing.JLabel();
    setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

    //        displayGraph = new javax.swing.JComboBox();
    //        displayGraph.setModel(new javax.swing.DefaultComboBoxModel( graphs ));
    //        displayGraph.addActionListener(new java.awt.event.ActionListener() {
    //            public void actionPerformed(java.awt.event.ActionEvent evt) {
    //                displayGraphActionPerformed(evt);
    //            }
    //        });
    //
    //        add(displayGraph, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 180, 180, 30));

    graphLabel.setText("Show graph");
    add(graphLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(5, 160, 170, -1));

    logo.setIcon(new javax.swing.ImageIcon(getClass().getResource(GUIState.logoPath)));
    add(logo, new org.netbeans.lib.awtextra.AbsoluteConstraints(5, 10, -1, -1));
    fc = new JFileChooser();
    fc.addChoosableFileFilter(new PNGFilter());
    fc.addChoosableFileFilter(new JPGFilter());
    fc.addChoosableFileFilter(new PDFFilter());
    fc.addChoosableFileFilter(new EPSFilter());

    showAQRT.setText("Average query response time");
    add(showAQRT, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 180, -1, -1));

    showRP.setText("Recall/Precision");
    add(showRP, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 200, -1, -1));

    showMemory.setText("Memory consumption");
    add(showMemory, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 220, -1, -1));

    save.setText("Save displayed graph");
    save.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveActionPerformed(evt);
        }
    });
    add(save, new org.netbeans.lib.awtextra.AbsoluteConstraints(5, 280, 245, -1));

    show.setText("Show");
    add(show, new org.netbeans.lib.awtextra.AbsoluteConstraints(5, 250, 120, -1));
    show.addActionListener(this);

    launch.setText("New window");
    add(launch, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 250, 120, -1));
    launch.addActionListener(this);

    //        showWindow.setText("Show in seperate window");
    //        add(showWindow, new org.netbeans.lib.awtextra.AbsoluteConstraints(2, 200, -1, -1));    

    setMinimumSize(new java.awt.Dimension(800, 400));
    setPreferredSize(new java.awt.Dimension(800, 400));
}

From source file:edu.purdue.cc.bionet.ui.CorrelationDisplayPanel.java

/**
 * Adds all of the necessary Components to this Component.
 *///from  w w  w .j  a va  2s.c om
private void buildPanel() {

    Language language = Settings.getLanguage();
    this.correlationMethodMenu = new JMenu(language.get("Correlation Method"));
    this.correlationMethodMenuButtonGroup = new ButtonGroup();
    this.pearsonCalculationMenuItem = new JRadioButtonMenuItem(language.get("Pearson"), true);
    this.spearmanCalculationMenuItem = new JRadioButtonMenuItem(language.get("Spearman"));
    this.kendallCalculationMenuItem = new JRadioButtonMenuItem(language.get("Kendall"));

    // layout menu itmes
    this.layoutMenu = new JMenu(language.get("Layout"));
    this.layoutMenuButtonGroup = new ButtonGroup();
    this.multipleCirclesLayoutMenuItem = new JRadioButtonMenuItem(language.get("Multiple Circles"));
    this.singleCircleLayoutMenuItem = new JRadioButtonMenuItem(language.get("Single Circle"), true);
    this.randomLayoutMenuItem = new JRadioButtonMenuItem(language.get("Random"));
    this.heatMapLayoutMenuItem = new JRadioButtonMenuItem(language.get("Heat Map"));
    this.kkLayoutMenuItem = new JRadioButtonMenuItem(language.get("Kamada-Kawai"));
    //      this.frLayoutMenuItem = 
    //            new JRadioButtonMenuItem( language.get( "Fruchterman-Reingold" ));
    //      this.springLayoutMenuItem = 
    //               new JRadioButtonMenuItem( language.get( "Spring Layout" ));
    this.frSpringLayoutMenuItem = new JRadioButtonMenuItem(language.get("Spring Layout"));
    //      this.animatedLayoutMenuItem = new JCheckBoxMenuItem( 
    //         language.get( "Fruchterman-Reingold Spring Embedding" ));

    // view menu items
    this.viewMenu = new JMenu(language.get("View"));
    this.zoomInViewMenuItem = new JMenuItem(language.get("Zoom In"), KeyEvent.VK_I);
    this.zoomOutViewMenuItem = new JMenuItem(language.get("Zoom Out"), KeyEvent.VK_O);
    this.fitToWindowViewMenuItem = new JMenuItem(language.get("Fit to Window"), KeyEvent.VK_F);
    this.selectAllViewMenuItem = new JMenuItem(language.get("Select All"), KeyEvent.VK_A);
    this.clearSelectionViewMenuItem = new JMenuItem(language.get("Clear Selection"), KeyEvent.VK_C);
    this.invertSelectionViewMenuItem = new JMenuItem(language.get("Invert Selection"), KeyEvent.VK_I);
    this.selectCorrelatedViewMenuItem = new JMenuItem(language.get("Select Correlated to Selection"),
            KeyEvent.VK_R);
    this.hideSelectedViewMenuItem = new JMenuItem(language.get("Hide Selected"), KeyEvent.VK_H);
    this.hideUnselectedViewMenuItem = new JMenuItem(language.get("Hide Unselected"), KeyEvent.VK_U);
    this.hideUncorrelatedViewMenuItem = new JMenuItem(language.get("Hide Uncorrelated to Selection"),
            KeyEvent.VK_L);
    this.hideOrphansViewMenuItem = new JMenuItem(language.get("Hide Orphans"), KeyEvent.VK_P);
    this.showCorrelatedViewMenuItem = new JMenuItem(language.get("Show All Correlated to Visible"),
            KeyEvent.VK_S);
    this.saveImageAction = new SaveImageAction(language.get("Save Main Graph Image") + "...", null);

    // groups menu items
    this.groupsMenu = new JMenu(language.get("Groups"));
    this.resetSampleGroupsMenuItem = new JMenuItem(language.get("Reset Sample Groups"), KeyEvent.VK_R);
    this.chooseSampleGroupsMenuItem = new JMenuItem(language.get("Choose Sample Groups") + "...",
            KeyEvent.VK_C);

    // color menu items
    this.colorMenu = new JMenu(language.get("Color"));
    this.colorMenuButtonGroup = new ButtonGroup();
    this.normalColorMenuItem = new JRadioButtonMenuItem(language.get("Normal Color"), true);
    this.highContrastColorMenuItem = new JRadioButtonMenuItem(language.get("High Contrast Color"));

    // CORRELATION FILTER ELEMENTS
    JPanel leftPanel = new JPanel(new BorderLayout());
    this.moleculeFilterPanel = new MoleculeFilterPanel();
    leftPanel.add(moleculeFilterPanel, BorderLayout.CENTER);
    this.correlationFilterPanel = new CorrelationFilterPanel();
    leftPanel.add(this.correlationFilterPanel, BorderLayout.SOUTH);

    //CALCULATION MENU
    this.correlationMethodMenu.setMnemonic(KeyEvent.VK_C);
    this.correlationMethodMenu.getAccessibleContext()
            .setAccessibleDescription(language.get("Perform Data Calculations"));
    this.correlationMethodMenuButtonGroup.add(this.pearsonCalculationMenuItem);
    this.correlationMethodMenuButtonGroup.add(this.spearmanCalculationMenuItem);
    this.correlationMethodMenuButtonGroup.add(this.kendallCalculationMenuItem);
    this.pearsonCalculationMenuItem.setMnemonic(KeyEvent.VK_P);
    this.spearmanCalculationMenuItem.setMnemonic(KeyEvent.VK_S);
    this.kendallCalculationMenuItem.setMnemonic(KeyEvent.VK_K);
    this.correlationMethodMenu.add(this.pearsonCalculationMenuItem);
    this.correlationMethodMenu.add(this.spearmanCalculationMenuItem);
    this.correlationMethodMenu.add(this.kendallCalculationMenuItem);
    this.pearsonCalculationMenuItem.addItemListener(this);
    this.spearmanCalculationMenuItem.addItemListener(this);
    this.kendallCalculationMenuItem.addItemListener(this);

    //LAYOUT MENU
    LayoutChangeListener lcl = new LayoutChangeListener();
    this.layoutMenu.setMnemonic(KeyEvent.VK_L);
    this.layoutMenu.getAccessibleContext()
            .setAccessibleDescription(language.get("Change the layout of the graph"));
    this.layoutMenuButtonGroup.add(this.multipleCirclesLayoutMenuItem);
    this.layoutMenuButtonGroup.add(this.singleCircleLayoutMenuItem);
    this.layoutMenuButtonGroup.add(this.randomLayoutMenuItem);
    this.layoutMenuButtonGroup.add(this.kkLayoutMenuItem);
    //      this.layoutMenuButtonGroup.add( this.frLayoutMenuItem );
    //      this.layoutMenuButtonGroup.add( this.springLayoutMenuItem );
    this.layoutMenuButtonGroup.add(this.frSpringLayoutMenuItem);
    this.layoutMenuButtonGroup.add(this.heatMapLayoutMenuItem);

    Enumeration<AbstractButton> e = this.layoutMenuButtonGroup.getElements();
    this.layoutMenu.add(this.multipleCirclesLayoutMenuItem);
    this.layoutMenu.add(this.singleCircleLayoutMenuItem);
    this.layoutMenu.add(this.randomLayoutMenuItem);
    this.layoutMenu.add(this.kkLayoutMenuItem);
    //      this.layoutMenu.add( this.frLayoutMenuItem );
    //      this.layoutMenu.add( this.springLayoutMenuItem );
    this.layoutMenu.add(this.frSpringLayoutMenuItem);
    this.layoutMenu.add(this.heatMapLayoutMenuItem);
    //      this.layoutMenu.addSeparator( );
    //      this.layoutMenu.add( this.animatedLayoutMenuItem );
    this.multipleCirclesLayoutMenuItem.addActionListener(lcl);
    this.multipleCirclesLayoutMenuItem.setEnabled(false);
    this.singleCircleLayoutMenuItem.addActionListener(lcl);
    this.randomLayoutMenuItem.addActionListener(lcl);
    this.kkLayoutMenuItem.addActionListener(lcl);
    //      this.frLayoutMenuItem.addActionListener( lcl );
    this.frSpringLayoutMenuItem.addActionListener(lcl);
    this.heatMapLayoutMenuItem.addActionListener(lcl);
    //      this.animatedLayoutMenuItem.addActionListener( lcl );

    //VIEW MENU
    this.viewMenu.add(this.colorMenu);
    this.viewMenu.addSeparator();
    this.viewMenu.setMnemonic(KeyEvent.VK_V);
    this.viewMenu.getAccessibleContext()
            .setAccessibleDescription(language.get("Change the data view settings"));
    this.viewMenu.add(this.zoomOutViewMenuItem);
    this.viewMenu.add(this.zoomInViewMenuItem);
    this.viewMenu.add(this.fitToWindowViewMenuItem);
    this.viewMenu.addSeparator();
    this.viewMenu.add(this.selectAllViewMenuItem);
    this.viewMenu.add(this.clearSelectionViewMenuItem);
    this.viewMenu.add(this.invertSelectionViewMenuItem);
    this.viewMenu.add(this.selectCorrelatedViewMenuItem);
    this.viewMenu.addSeparator();
    this.viewMenu.add(this.hideSelectedViewMenuItem);
    this.viewMenu.add(this.hideUnselectedViewMenuItem);
    this.viewMenu.add(this.hideUncorrelatedViewMenuItem);
    this.viewMenu.add(this.hideOrphansViewMenuItem);
    this.viewMenu.add(this.showCorrelatedViewMenuItem);
    this.viewMenu.addSeparator();
    this.viewMenu.add(this.saveImageAction);
    this.resetSampleGroupsMenuItem.addActionListener(this);
    this.chooseSampleGroupsMenuItem.addActionListener(this);
    this.zoomOutViewMenuItem.addActionListener(this);
    this.zoomInViewMenuItem.addActionListener(this);
    this.fitToWindowViewMenuItem.addActionListener(this);
    this.selectAllViewMenuItem.addActionListener(this);
    this.clearSelectionViewMenuItem.addActionListener(this);
    this.invertSelectionViewMenuItem.addActionListener(this);
    this.selectCorrelatedViewMenuItem.addActionListener(this);
    this.hideSelectedViewMenuItem.addActionListener(this);
    this.hideUnselectedViewMenuItem.addActionListener(this);
    this.hideUncorrelatedViewMenuItem.addActionListener(this);
    this.hideOrphansViewMenuItem.addActionListener(this);
    this.showCorrelatedViewMenuItem.addActionListener(this);
    this.selectAllViewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK));
    this.clearSelectionViewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));

    // GROUPS MENU
    this.groupsMenu.setMnemonic(KeyEvent.VK_G);
    this.groupsMenu.add(this.resetSampleGroupsMenuItem);
    this.groupsMenu.add(this.chooseSampleGroupsMenuItem);

    this.zoomOutViewMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_DOWN_MASK));
    this.zoomInViewMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.CTRL_DOWN_MASK));
    this.fitToWindowViewMenuItem
            .setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_0, InputEvent.CTRL_DOWN_MASK));
    this.hideSelectedViewMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));

    //COLOR MENU
    this.colorMenu.setMnemonic(KeyEvent.VK_R);
    this.colorMenu.getAccessibleContext()
            .setAccessibleDescription(language.get("Change the color of the graph"));
    this.colorMenuButtonGroup.add(this.normalColorMenuItem);
    this.colorMenuButtonGroup.add(this.highContrastColorMenuItem);
    this.colorMenu.add(this.normalColorMenuItem);
    this.colorMenu.add(this.highContrastColorMenuItem);
    this.normalColorMenuItem.addItemListener(this);
    this.highContrastColorMenuItem.addItemListener(this);

    this.menuBar.add(this.correlationMethodMenu);
    this.menuBar.add(this.layoutMenu);
    this.menuBar.add(this.viewMenu);
    this.menuBar.add(this.groupsMenu);

    // Add the panels to the main panel
    this.add(menuBar, BorderLayout.NORTH);
    //      this.add( this.correlationViewPanel, BorderLayout.CENTER );
    this.add(leftPanel, BorderLayout.WEST);
}