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:StockForecast.Main.java

private void groupButtonProfile() {
    ButtonGroup bg1 = new ButtonGroup();
    bg1.add(jRadioButton1);
    bg1.add(jRadioButton2);
}

From source file:StockForecast.Main.java

private void groupButtonStock() {
    ButtonGroup bg1 = new ButtonGroup();
    bg1.add(jRadioButton3);
    bg1.add(jRadioButton4);
}

From source file:test.visualization.PluggableRendererDemo.java

/**
 * @param jp    panel to which controls will be added
 *//*from w ww.  ja  va2 s . c o  m*/
@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);
    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);

    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() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(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()) {
        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() {
        public void itemStateChanged(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:tvbrowser.extras.favoritesplugin.wizards.TypeWizardStep.java

public JPanel createContent(final WizardHandler handler) {

    LinkButton expertBtn = new LinkButton(mLocalizer.msg("advancedView", "Switch to expert view"), null);

    CellConstraints cc = new CellConstraints();
    PanelBuilder panelBuilder = new PanelBuilder(
            new FormLayout("5dlu, pref, default:grow", "pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 5dlu, pref"));

    panelBuilder.add(new JLabel(mMainQuestion), cc.xyw(1, 1, 3));
    panelBuilder.add(mTitleRb = new JRadioButton(mLocalizer.msg("option.title", "I like this program:")),
            cc.xy(2, 3));/*from w ww  .j  av a  2 s.  c om*/
    panelBuilder.add(mProgramNameTf = new JTextField(), cc.xy(3, 3));
    panelBuilder.add(mTopicRb = new JRadioButton(mLocalizer.msg("option.topic", "I like this subject:")),
            cc.xy(2, 5));
    panelBuilder.add(mTopicTf = new JTextField(), cc.xy(3, 5));

    panelBuilder.add(mActorsRb = new JRadioButton(mLocalizer.msg("option.actors", "I like these actors:")),
            cc.xy(2, 7));
    mActorsCb = new JComboBox();
    mActorsCb.setEditable(true);
    panelBuilder.add(mActorsCb, cc.xy(3, 7));
    panelBuilder.setBorder(Borders.DLU4_BORDER);
    panelBuilder.add(expertBtn, cc.xyw(1, 9, 3));
    ButtonGroup group = new ButtonGroup();
    group.add(mTitleRb);
    group.add(mTopicRb);
    group.add(mActorsRb);

    mTitleRb.setSelected(true);

    updateTextfields();

    mTitleRb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateTextfields();
        }
    });

    mTopicRb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateTextfields();
        }
    });

    mActorsRb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateTextfields();
        }
    });

    expertBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            handler.closeCurrentStep();
            String title;
            if (mProgram != null) {
                title = mProgram.getTitle();
            } else {
                title = "";
            }
            AdvancedFavorite favorite = new AdvancedFavorite(title);
            Window parent = UiUtilities.getLastModalChildOf(MainFrame.getInstance());
            EditFavoriteDialog dlg = new EditFavoriteDialog(parent, favorite);
            UiUtilities.centerAndShow(dlg);
            if (dlg.getOkWasPressed()) {
                FavoriteTreeModel.getInstance().addFavorite(favorite, mParentNode);
                FavoritesPlugin.getInstance().updateRootNode(true);

                if (ManageFavoritesDialog.getInstance() != null) {
                    ManageFavoritesDialog.getInstance().addFavorite(favorite, false);
                }
            }
        }
    });

    if (mProgram != null) {
        mProgramNameTf.setText(mProgram.getTitle());
        String[] actors = ProgramUtilities.getActorNames(mProgram);
        if (actors != null) {
            for (String actor : actors) {
                mActorsCb.addItem(actor);
            }
        }
    }

    mContent = panelBuilder.getPanel();

    mContent.addComponentListener(new ComponentAdapter() {
        public void componentResized(ComponentEvent e) {
            handleFocusEvent();
        }
    });

    mContent.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            handleFocusEvent();
        }
    });

    if (mTopic != null) {
        mTopicRb.setSelected(true);
        updateTextfields();
        mTopicTf.setText(mTopic);
        // the topic might also be an actor name
        if (mActor == null && ProgramUtilities.getActorNames(mProgram) == null) {
            mActorsCb.setSelectedItem(mTopic);
        }
    } else if (mActor != null) {
        mActorsRb.setSelected(true);
        updateTextfields();
        mActorsCb.setSelectedItem(mActor);
    }

    return mContent;
}

From source file:tvbrowser.extras.reminderplugin.ReminderSettingsTab.java

/**
 * Creates the settings panel for this tab.
 *///ww  w.j  a  va 2s  .com
public JPanel createSettingsPanel() {
    FormLayout layout = new FormLayout("5dlu,pref,5dlu,pref,pref:grow,3dlu,pref,3dlu,pref,5dlu",
            "pref,5dlu,pref,1dlu,pref,1dlu,pref,1dlu,pref,10dlu,pref,5dlu,"
                    + "pref,10dlu,pref,5dlu,pref,10dlu,pref,5dlu,pref,10dlu,"
                    + "pref,5dlu,pref,3dlu,pref,10dlu,pref,5dlu,pref");
    layout.setColumnGroups(new int[][] { { 7, 9 } });
    PanelBuilder pb = new PanelBuilder(layout, new ScrollableJPanel());
    pb.setDefaultDialogBorder();

    CellConstraints cc = new CellConstraints();

    final String[] extArr = { ".wav", ".aif", ".rmf", ".au", ".mid" };
    String soundFName = mSettings.getProperty("soundfile", "/");
    String msg = mLocalizer.msg("soundFileFilter", "Sound file ({0})", "*" + StringUtils.join(extArr, ", *"));

    mReminderWindowChB = new JCheckBox(mLocalizer.msg("reminderWindow", "Reminder window"),
            mSettings.getProperty("usemsgbox", "false").equalsIgnoreCase("true"));

    mShowAlwaysOnTop = new JCheckBox(mLocalizer.msg("alwaysOnTop", "Show always on top"),
            mSettings.getProperty("alwaysOnTop", "true").equalsIgnoreCase("true"));
    mShowAlwaysOnTop.setEnabled(mReminderWindowChB.isSelected());

    JPanel reminderWindowCfg = new JPanel(new FormLayout("12dlu,default:grow", "pref,1dlu,pref"));
    reminderWindowCfg.add(mReminderWindowChB, cc.xyw(1, 1, 2));
    reminderWindowCfg.add(mShowAlwaysOnTop, cc.xy(2, 3));

    mSoundFileChB = new FileCheckBox(mLocalizer.msg("playlingSound", "Play sound"), new File(soundFName), 0,
            false);

    JFileChooser soundChooser = new JFileChooser((String) null);
    soundChooser.setFileFilter(new ExtensionFileFilter(extArr, msg));

    mSoundFileChB.setFileChooser(soundChooser);

    mSoundFileChB.setSelected(mSettings.getProperty("usesound", "false").equals("true"));

    mBeep = new JCheckBox(mLocalizer.msg("beep", "Speaker sound"),
            mSettings.getProperty("usebeep", "true").equalsIgnoreCase("true"));

    mExecFileStr = mSettings.getProperty("execfile", "");
    mExecParamStr = mSettings.getProperty("execparam", "");

    final JButton soundTestBt = new JButton(mLocalizer.msg("test", "Test"));

    mExecChB = new JCheckBox(mLocalizer.msg("executeProgram", "Execute program"));
    mExecChB.setSelected(mSettings.getProperty("useexec", "false").equals("true"));

    mExecFileDialogBtn = new JButton(mLocalizer.msg("executeConfig", "Configure"));
    mExecFileDialogBtn.setEnabled(mExecChB.isSelected());

    mPluginLabel = new JLabel();
    JButton choose = new JButton(mLocalizer.msg("selectPlugins", "Choose Plugins"));

    mClientPluginTargets = ReminderPlugin.getInstance().getClientPluginsTargets();

    handlePluginSelection();

    choose.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                Window parent = UiUtilities.getLastModalChildOf(MainFrame.getInstance());
                PluginChooserDlg chooser = null;
                chooser = new PluginChooserDlg(parent, mClientPluginTargets, null,
                        ReminderPluginProxy.getInstance());

                chooser.setLocationRelativeTo(parent);
                chooser.setVisible(true);

                if (chooser.getReceiveTargets() != null) {
                    mClientPluginTargets = chooser.getReceiveTargets();
                }

                handlePluginSelection();
            } catch (Exception ee) {
                ee.printStackTrace();
            }
        }
    });

    int autoCloseReminderTime = 10;
    try {
        String asString = mSettings.getProperty("autoCloseReminderTime", "10");
        autoCloseReminderTime = Integer.parseInt(asString);

        if (autoCloseReminderTime == 0) {
            autoCloseReminderTime = 10;
        }
    } catch (Exception exc) {
        // ignore
    }

    mCloseOnEnd = new JRadioButton(mLocalizer.msg("autoCloseReminderAtProgramEnd", "Program end"),
            mSettings.getProperty("autoCloseBehaviour", "onEnd").equals("onEnd"));
    mCloseOnEnd.setEnabled(mReminderWindowChB.isSelected());

    mCloseNever = new JRadioButton(mLocalizer.msg("autoCloseNever", "Never close"),
            mSettings.getProperty("autoCloseBehaviour", "onEnd").equals("never"));
    mCloseNever.setEnabled(mReminderWindowChB.isSelected());

    mCloseOnTime = new JRadioButton(mLocalizer.ellipsisMsg("autoCloseAfterTime", "After time"),
            mSettings.getProperty("autoCloseBehaviour", "onEnd").equals("onTime"));
    mCloseOnTime.setEnabled(mReminderWindowChB.isSelected());

    ButtonGroup bg = new ButtonGroup();

    bg.add(mCloseOnEnd);
    bg.add(mCloseNever);
    bg.add(mCloseOnTime);

    mAutoCloseReminderTimeSp = new JSpinner(
            new SpinnerNumberModel(autoCloseReminderTime, autoCloseReminderTime < 5 ? 1 : 5, 600, 1));
    mAutoCloseReminderTimeSp.setEnabled(mCloseOnTime.isSelected() && mReminderWindowChB.isSelected());

    mShowTimeCounter = new JCheckBox(mLocalizer.msg("showTimeCounter", "Show time counter"),
            mSettings.getProperty("showTimeCounter", "false").compareTo("true") == 0);
    mShowTimeCounter.setEnabled(!mCloseNever.isSelected() && mReminderWindowChB.isSelected());

    PanelBuilder autoClosePanel = new PanelBuilder(
            new FormLayout("12dlu,default,2dlu,default:grow", "pref,2dlu,pref,2dlu,pref,2dlu,pref,10dlu,pref"));
    autoClosePanel.add(mCloseOnEnd, cc.xyw(1, 1, 4));
    autoClosePanel.add(mCloseNever, cc.xyw(1, 3, 4));
    autoClosePanel.add(mCloseOnTime, cc.xyw(1, 5, 4));
    autoClosePanel.add(mAutoCloseReminderTimeSp, cc.xy(2, 7));

    final JLabel secondsLabel = autoClosePanel.addLabel(mLocalizer.msg("seconds", "seconds (0 = off)"),
            cc.xy(4, 7));

    autoClosePanel.add(mShowTimeCounter, cc.xyw(1, 9, 4));

    secondsLabel.setEnabled(mCloseOnTime.isSelected() && mReminderWindowChB.isSelected());

    String defaultReminderEntryStr = (String) mSettings.get("defaultReminderEntry");
    mDefaultReminderEntryList = new JComboBox(ReminderDialog.SMALL_REMIND_MSG_ARR);
    if (defaultReminderEntryStr != null) {
        try {
            int inx = Integer.parseInt(defaultReminderEntryStr);
            if (inx < ReminderDialog.SMALL_REMIND_MSG_ARR.length) {
                mDefaultReminderEntryList.setSelectedIndex(inx);
            }
        } catch (NumberFormatException e) {
            // ignore
        }
    }

    mShowTimeSelectionDlg = new JCheckBox(
            mLocalizer.msg("showTimeSelectionDialog", "Show time selection dialog"));
    mShowTimeSelectionDlg
            .setSelected(mSettings.getProperty("showTimeSelectionDialog", "true").compareTo("true") == 0);
    mShowRemovedDlg = new JCheckBox(
            mLocalizer.msg("showRemovedDialog", "Show removed reminders after data update"));
    mShowRemovedDlg.setSelected(mSettings.getProperty("showRemovedDialog", "true").compareTo("true") == 0);

    pb.addSeparator(mLocalizer.msg("remindBy", "Remind me by"), cc.xyw(1, 1, 10));

    pb.add(reminderWindowCfg, cc.xyw(2, 3, 4));
    pb.add(mSoundFileChB, cc.xyw(2, 5, 4));
    pb.add(mSoundFileChB.getButton(), cc.xy(7, 5));
    pb.add(soundTestBt, cc.xy(9, 5));
    pb.add(mBeep, cc.xy(2, 7));
    pb.add(mExecChB, cc.xyw(2, 9, 4));
    pb.add(mExecFileDialogBtn, cc.xyw(7, 9, 3));

    pb.addSeparator(mLocalizer.msg("sendToPlugin", "Send reminded program to"), cc.xyw(1, 11, 10));

    pb.add(mPluginLabel, cc.xyw(2, 13, 4));
    pb.add(choose, cc.xyw(7, 13, 3));

    final JLabel c = (JLabel) pb
            .addSeparator(mLocalizer.msg("autoCloseReminder", "Automatically close reminder"),
                    cc.xyw(1, 15, 10))
            .getComponent(0);
    c.setEnabled(mReminderWindowChB.isSelected());

    pb.add(autoClosePanel.getPanel(), cc.xyw(2, 17, 5));

    JPanel reminderEntry = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
    reminderEntry.add(mDefaultReminderEntryList);

    pb.addSeparator(mLocalizer.msg("defaltReminderEntry", "Default reminder time"), cc.xyw(1, 19, 10));
    pb.add(reminderEntry, cc.xyw(2, 21, 4));

    pb.addSeparator(mLocalizer.msg("miscSettings", "Misc settings"), cc.xyw(1, 23, 10));
    pb.add(mShowTimeSelectionDlg, cc.xyw(2, 25, 7));
    pb.add(mShowRemovedDlg, cc.xyw(2, 27, 7));

    pb.addSeparator(DefaultMarkingPrioritySelectionPanel.getTitle(), cc.xyw(1, 29, 10));
    pb.add(mMarkingsPanel = DefaultMarkingPrioritySelectionPanel
            .createPanel(ReminderPlugin.getInstance().getMarkPriority(), false, false), cc.xyw(2, 31, 9));

    mReminderWindowChB.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            mShowAlwaysOnTop.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            c.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            secondsLabel.setEnabled(e.getStateChange() == ItemEvent.SELECTED && mCloseOnTime.isSelected());
            mCloseOnEnd.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            mCloseNever.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            mCloseOnTime.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
            mShowTimeCounter.setEnabled(e.getStateChange() == ItemEvent.SELECTED && !mCloseNever.isSelected());
            mAutoCloseReminderTimeSp
                    .setEnabled(e.getStateChange() == ItemEvent.SELECTED && mCloseOnTime.isSelected());
        }
    });

    soundTestBt.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            if (evt.getActionCommand().compareTo(mLocalizer.msg("test", "Test")) == 0) {
                mTestSound = ReminderPlugin.playSound(mSoundFileChB.getTextField().getText());
                if (mTestSound != null) {
                    soundTestBt.setText(mLocalizer.msg("stop", "Stop"));
                }
                if (mTestSound != null) {
                    if (mTestSound instanceof SourceDataLine) {
                        ((SourceDataLine) mTestSound).addLineListener(new LineListener() {
                            public void update(LineEvent event) {
                                if (event.getType() == Type.CLOSE) {
                                    soundTestBt.setText(mLocalizer.msg("test", "Test"));
                                }
                            }
                        });
                    } else if (mTestSound instanceof Sequencer) {
                        new Thread("Test MIDI sound") {
                            public void run() {
                                setPriority(Thread.MIN_PRIORITY);
                                while (((Sequencer) mTestSound).isRunning()) {
                                    try {
                                        Thread.sleep(100);
                                    } catch (Exception ee) {
                                    }
                                }

                                soundTestBt.setText(mLocalizer.msg("test", "Test"));
                            }
                        }.start();
                    }
                }
            } else if (mTestSound != null) {
                if (mTestSound instanceof SourceDataLine && ((SourceDataLine) mTestSound).isRunning()) {
                    ((SourceDataLine) mTestSound).stop();
                } else if (mTestSound instanceof Sequencer && ((Sequencer) mTestSound).isRunning()) {
                    ((Sequencer) mTestSound).stop();
                }
            }
        }
    });

    mSoundFileChB.getCheckBox().addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            soundTestBt.setEnabled(mSoundFileChB.isSelected());
        }
    });

    mSoundFileChB.getTextField().addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent e) {
            String text = mSoundFileChB.getTextField().getText();
            if ((new File(text)).isFile()) {
                boolean notFound = true;
                for (String extension : extArr) {
                    if (StringUtils.endsWithIgnoreCase(text, extension)) {
                        notFound = false;
                        break;
                    }
                }

                if (notFound) {
                    soundTestBt.setEnabled(false);
                } else {
                    soundTestBt.setEnabled(true);
                }
            } else {
                soundTestBt.setEnabled(false);
            }
        }
    });
    mSoundFileChB.getTextField().getKeyListeners()[0].keyReleased(null);

    mExecChB.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            mExecFileDialogBtn.setEnabled(mExecChB.isSelected());
            if (mExecFileDialogBtn.isEnabled()) {
                showFileSettingsDialog();
            }
        }
    });

    mExecFileDialogBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            showFileSettingsDialog();
        }
    });

    ItemListener autoCloseListener = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            mAutoCloseReminderTimeSp.setEnabled(mCloseOnTime.isSelected());
            secondsLabel.setEnabled(mCloseOnTime.isSelected());
            mShowTimeCounter.setEnabled(mCloseOnTime.isSelected() || mCloseOnEnd.isSelected());
        }
    };

    mCloseOnEnd.addItemListener(autoCloseListener);
    mCloseOnTime.addItemListener(autoCloseListener);

    mCloseOnTime.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            mShowTimeCounter.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
        }
    });

    JScrollPane scrollPane = new JScrollPane(pb.getPanel());
    scrollPane.setBorder(null);
    scrollPane.setViewportBorder(null);

    JPanel scrollPanel = new JPanel(new FormLayout("default:grow", "default"));
    scrollPanel.add(scrollPane, cc.xy(1, 1));

    return scrollPanel;
}

From source file:tvbrowser.ui.settings.WebbrowserSettingsTab.java

/**
 * Creates the settings panel for this tab.
 *///from  w  ww.  jav  a  2 s  .com
public JPanel createSettingsPanel() {
    mSettingsPn = new JPanel(new FormLayout("5dlu, 10dlu, pref, 3dlu, pref, 3dlu, pref, fill:3dlu:grow, 3dlu",
            "pref, 5dlu, pref, 5dlu, pref, 5dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref"));
    mSettingsPn.setBorder(Borders.DIALOG_BORDER);

    CellConstraints cc = new CellConstraints();

    mSettingsPn.add(
            DefaultComponentFactory.getInstance().createSeparator(mLocalizer.msg("browser", "Web browser")),
            cc.xyw(1, 1, 9));

    JButton testButton = new LinkButton(mLocalizer.msg("testBrowser", "Test Webbrowser"),
            "http://www.tvbrowser.org", SwingConstants.LEFT, false);
    testButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String buffer = Settings.propUserDefinedWebbrowser.getString();
            String bufferParams = Settings.propUserDefinedWebbrowserParams.getString();
            saveSettings();
            Launch.openURL("http://www.tvbrowser.org");
            Settings.propUserDefinedWebbrowser.setString(buffer);
            Settings.propUserDefinedWebbrowserParams.setString(bufferParams);
        }
    });

    mSettingsPn.add(UiUtilities.createHelpTextArea(mLocalizer.msg("help", "Help Text")), cc.xyw(2, 3, 7));

    mSettingsPn.add(testButton, cc.xyw(2, 5, 7));

    mSettingsPn.add(new JLabel(mLocalizer.msg("whichBrowser", "which browser")), cc.xyw(2, 7, 7));

    JRadioButton useDefault = new JRadioButton(mLocalizer.msg("defaultWebbrowser", "Default Webbrowser"));
    useDefault.setSelected(Settings.propUserDefinedWebbrowser.getString() == null);
    useDefault.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateInputFields();
        }
    });

    mSettingsPn.add(useDefault, cc.xyw(2, 9, 4));

    mUseWebbrowser = new JRadioButton(mLocalizer.msg("userDefinedWebbrowser", "user defined webbrowser"));
    mUseWebbrowser.setSelected(Settings.propUserDefinedWebbrowser.getString() != null);

    mUseWebbrowser.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateInputFields();
        }
    });

    ButtonGroup group = new ButtonGroup();
    group.add(useDefault);
    group.add(mUseWebbrowser);

    mSettingsPn.add(mUseWebbrowser, cc.xyw(2, 11, 7));

    mSettingsPn.add(new JLabel(mLocalizer.msg("browserExecutable", "Executable") + ":"), cc.xy(3, 13));

    mFileTextField = new JTextField(30);
    mFileTextField.setText(Settings.propUserDefinedWebbrowser.getString());
    mSettingsPn.add(mFileTextField, cc.xy(5, 13));

    mChooseButton = new JButton(Localizer.getLocalization(Localizer.I18N_SELECT));
    mChooseButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            if (mFileChooser == null) {
                mFileChooser = new JFileChooser();

                if (OperatingSystem.isMacOs()) {
                    mFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
                } else {
                    mFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
                }
            }

            int retVal = mFileChooser.showOpenDialog(mSettingsPn.getParent());
            if (retVal == JFileChooser.APPROVE_OPTION) {
                File f = mFileChooser.getSelectedFile();
                if (f != null) {
                    mFileTextField.setText(f.getAbsolutePath());
                }
            }
        }
    });
    mSettingsPn.add(mChooseButton, cc.xy(7, 13));

    mSettingsPn.add(new JLabel(mLocalizer.msg("browserParameter", "Parameter") + ":"), cc.xy(3, 15));

    mParams = new JTextField();
    mParams.setText(Settings.propUserDefinedWebbrowserParams.getString());
    mSettingsPn.add(mParams, cc.xy(5, 15));

    mSettingsPn.add(new JLabel(mLocalizer.msg("browserParameterHelp", "{0} will be replaced by the url.")),
            cc.xyw(5, 17, 4));

    updateInputFields();

    return mSettingsPn;
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.simulator.viewcomponent.DataGenerationPanel.java

/**
 * Inits the components.//from   w  w  w.j a  v  a2s  .co m
 */
public synchronized void initComponents() {

    while (activeFrame == null) {
        if (applicationService != null && applicationService.getFrameView() != null) {
            activeFrame = applicationService.getFrameView().getActiveFrame();
        }
    }

    JPanel runPanel = new JPanel();
    runPanel.setLayout(new BoxLayout(runPanel, BoxLayout.LINE_AXIS));
    runPanel.setBorder(BorderFactory.createEmptyBorder(paddingSize, paddingSize, paddingSize, paddingSize));
    JXLabel label = new JXLabel();
    label.setLineWrap(true);
    label.setText(
            "<html>This panel allows the creation of clinically plausible data based on a query specification. "
                    + "Please note that you <b>must</b> always specify a data generation source. "
                    + "The rest of the parameters can be left in their default state. When you've configured the parameters "
                    + "click the 'Generate data' button.</html>");
    runPanel.add(label);
    runPanel.add(new JSeparator(SwingConstants.VERTICAL));
    runPanel.add(Box.createHorizontalStrut(paddingSize));
    JideButton runButton = new JideButton(new GenerateDataAction(applicationService, queryService,
            dataGenerationEngine, propertyChangeTrackerService));
    runButton.setButtonStyle(ButtonStyle.HYPERLINK_STYLE);
    runPanel.add(runButton);
    runButton.setIcon(new ImageIcon(DataGenerationPanel.class.getResource("resources/linuxconf.png")));
    runPanel.add(Box.createHorizontalStrut(paddingSize));

    // create radio buttons for choosing source
    JRadioButton queryButton = new JRadioButton("Active Query");
    queryButton.setSelected(true);
    queryButton.addActionListener(this);
    queryButton.setActionCommand("activeQuery");
    JRadioButton fileButton = new JRadioButton("File");
    fileButton.addActionListener(this);
    fileButton.setActionCommand("file");

    JRadioButton folderButton = new JRadioButton("Folder");
    folderButton.addActionListener(this);
    folderButton.setActionCommand("folder");
    ButtonGroup bg = new ButtonGroup();
    bg.add(queryButton);
    bg.add(fileButton);
    bg.add(folderButton);
    JPanel buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.LINE_AXIS));
    //      buttonsPanel.add(new JLabel("Select data generation source"));
    buttonsPanel.setBorder(BorderFactory.createTitledBorder("Select data generation source"));
    buttonsPanel.add(Box.createHorizontalStrut(paddingSize));
    buttonsPanel.add(queryButton);
    buttonsPanel.add(Box.createHorizontalStrut(paddingSize));
    buttonsPanel.add(fileButton);
    buttonsPanel.add(Box.createHorizontalStrut(paddingSize));
    buttonsPanel.add(folderButton);

    locationField = new JTextField(100);
    JButton loadQueryButton = new JButton("Browse");
    loadQueryButton.addActionListener(this);
    loadQueryButton.setActionCommand("load");
    locationPanel = new JPanel();
    locationPanel.setLayout(new BoxLayout(locationPanel, BoxLayout.LINE_AXIS));
    locationPanel.add(new JLabel("Load file from"));
    locationPanel.add(Box.createHorizontalStrut(paddingSize));
    locationPanel.add(locationField);
    locationPanel.add(Box.createHorizontalStrut(paddingSize));
    locationPanel.add(loadQueryButton);

    JPanel lhsPanel = new JPanel(new GridLayout(0, 2));
    JPanel rhsPanel = new JPanel(new GridLayout(0, 2));

    lhsPanel.add(new JLabel("Max number of patients to generate"));

    SpinnerNumberModel model = new SpinnerNumberModel(initialPatientsNumber, 1, 1000000, 1);
    ptNumberSpinner = new JSpinner(model);
    ptNumberSpinner.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent event) {
            // get value currently selected in spinner and set in engine
            dataGenerationEngine.setMaxPatientNumber(Long.parseLong(ptNumberSpinner.getValue().toString()));
            //                Object value = ptNumberSpinner.getValue();
            //                if(value instanceof Double)
            //                {
            //                    Double d = (Double) ptNumberSpinner.getValue();
            //                    dataGenerationEngine.setMaxPatientNumber(d.longValue());
            //                }
            //                else
            //                {
            //                    dataGenerationEngine.setMaxPatientNumber(Long.parseLong(ptNumberSpinner.getValue().toString()));
            //                }
            logger.debug("ptNumberSpinner.getValue().getClass() = " + ptNumberSpinner.getValue().getClass());
            logger.debug("Max pt number in engine set to : " + dataGenerationEngine.getMaxPatientNumber());
        }
    });
    lhsPanel.add(ptNumberSpinner);

    lhsPanel.add(new JLabel("Min age of patients to generate"));
    SpinnerNumberModel ageModel = new SpinnerNumberModel(initialMinimumAge, 1, 120, 1);
    minAgeSpinner = new JSpinner(ageModel);
    minAgeSpinner.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            // set min pt age to current value
            dataGenerationEngine.setMinPatientAgeInYears(Integer.parseInt(minAgeSpinner.getValue().toString()));
            logger.debug("Value of engine.getMinPatientAgeInYears() : "
                    + dataGenerationEngine.getMinPatientAgeInYears());
        }
    });
    lhsPanel.add(minAgeSpinner);

    lhsPanel.add(new JLabel("Data generation strategy"));
    generationStrategyBox = new JComboBox(DataGenerationEngine.DataGenerationStrategy.values());
    generationStrategyBox.setSelectedItem(DataGenerationEngine.DataGenerationStrategy.ADD_IF_NOT_EXISTS);
    generationStrategyBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            dataGenerationEngine.setDataGenerationStrategy(
                    (DataGenerationEngine.DataGenerationStrategy) generationStrategyBox.getSelectedItem());
        }
    });
    lhsPanel.add(generationStrategyBox);

    includeExcludedTermsBox = new JCheckBox(new AbstractAction("Include Excluded terms in data") {

        public void actionPerformed(ActionEvent arg0) {
            dataGenerationEngine.setIncludeExcludedTerms(includeExcludedTermsBox.isSelected());
            logger.debug("dataGenerationEngine.isIncludeExcludedTerms() = "
                    + dataGenerationEngine.isIncludeExcludedTerms());
        }
    });
    rhsPanel.add(includeExcludedTermsBox);

    randomiseNumericalValuesBox = new JCheckBox(new AbstractAction("Randomise Numerical values in data") {

        public void actionPerformed(ActionEvent arg0) {
            dataGenerationEngine.setRandomiseNumericalValues(randomiseNumericalValuesBox.isSelected());
            logger.debug("dataGenerationEngine.isRandomiseNumericalValues() = "
                    + dataGenerationEngine.isRandomiseNumericalValues());
        }
    });
    rhsPanel.add(randomiseNumericalValuesBox);

    refineQualifiersCheckBox = new JCheckBox(new AbstractAction("Refine Qualifiers in expression") {
        public void actionPerformed(ActionEvent e) {
            dataGenerationEngine.setRefineQualifiers(refineQualifiersCheckBox.isSelected());
            logger.debug(
                    "dataGenerationEngine.isRefineQualifiers() = " + dataGenerationEngine.isRefineQualifiers());
        }
    });
    rhsPanel.add(refineQualifiersCheckBox);

    includePreCoordinatedDataCheckBox = new JCheckBox(
            new AbstractAction("Include pre-coordinated expressions") {
                public void actionPerformed(ActionEvent e) {
                    dataGenerationEngine
                            .setIncludePrecoordinatedData(includePreCoordinatedDataCheckBox.isSelected());
                    logger.debug("dataGenerationEngine.isIncludePrecoordinatedData() = "
                            + dataGenerationEngine.isIncludePrecoordinatedData());
                }
            });
    rhsPanel.add(includePreCoordinatedDataCheckBox);
    rhsPanel.add(new JLabel("  "));

    /*
    * create panel for parametrising engine
    */
    JPanel parametrisationPanel = new JPanel();
    parametrisationPanel.setLayout(new GridLayout(0, 2));
    parametrisationPanel.setBorder(BorderFactory.createTitledBorder("Engine Parameters"));

    // add panels to parametrisation panel
    parametrisationPanel.add(lhsPanel);
    parametrisationPanel.add(rhsPanel);

    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.LINE_AXIS));
    topPanel.add(runPanel);
    topPanel.add(new JSeparator(SwingConstants.VERTICAL));
    topPanel.add(buttonsPanel);
    // add all panels to this component
    setLayout(new BorderLayout());
    add(topPanel, BorderLayout.NORTH);
    add(parametrisationPanel, BorderLayout.CENTER);

    // initialise values
    populateFields(dataGenerationEngine);
}

From source file:uk.nhs.cfh.dsp.yasb.searchpanel.SearchPanel.java

/**
 * Creates the button panel.//from  ww w  .j  a v  a2s  .  c o  m
 */
private void createButtonPanel() {

    buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.PAGE_AXIS));

    JPanel fieldsPanel = new JPanel();
    fieldsPanel.add(new JLabel("Search using "));
    fieldsPanel.add(Box.createHorizontalStrut(5));
    fieldsPanel.setLayout(new BoxLayout(fieldsPanel, BoxLayout.LINE_AXIS));
    // create button group for term selection
    JRadioButton allRadioButton = new JRadioButton(new AbstractAction("Term") {

        public void actionPerformed(ActionEvent event) {
            // set search on term
            searchConceptId = false;
            doSearch();
        }
    });

    JRadioButton idRadioButton = new JRadioButton(new AbstractAction("ID") {

        public void actionPerformed(ActionEvent event) {
            // set search on id
            searchConceptId = true;
            doSearch();
        }
    });

    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(allRadioButton);
    buttonGroup.add(idRadioButton);
    buttonGroup.setSelected(allRadioButton.getModel(), true);

    // add search field terms to fields panel
    fieldsPanel.add(allRadioButton);
    fieldsPanel.add(idRadioButton);
    fieldsPanel.add(Box.createHorizontalGlue());

    // create panel that contains button that toggles display of controlsPane
    JideButton controlsButton = new JideButton(new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            if (controlsPane.isCollapsed()) {
                controlsPane.setCollapsed(false);
            } else {
                controlsPane.setCollapsed(true);
            }
        }
    });
    controlsButton.setIcon(new ImageIcon(SearchPanel.class.getResource("resources/configure.png")));
    controlsButton.setToolTipText("Click to display or hide configuration panel");
    JPanel panel4 = new JPanel();
    panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS));
    panel4.add(Box.createHorizontalGlue());
    panel4.add(new JLabel("Change search and display preferences "));
    panel4.add(controlsButton);

    // add panels to button panel
    buttonsPanel.add(fieldsPanel);
    buttonsPanel.add(panel4);
}

From source file:unikn.dbis.univis.explorer.VExplorer.java

License:asdf

private void initMenuBar() {

    JMenuBar menuBar = new JMenuBar();

    VMenu program = new VMenu(Constants.PROGRAM);

    VMenuItem schemaImport = new VMenuItem(Constants.SCHEMA_IMPORT, VIcons.SCHEMA_IMPORT);
    schemaImport.setAccelerator(KeyStroke.getKeyStroke('I', Event.CTRL_MASK));
    schemaImport.addActionListener(new ActionListener() {
        /**/*from   w  w  w . ja  v  a 2s.  c o  m*/
         * Invoked when an action occurs.
         */
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileChooser = new JFileChooser();

            fileChooser.addChoosableFileFilter(new FileFilter() {

                /**
                 * Whether the given file is accepted by this filter.
                 */
                public boolean accept(File f) {
                    return f.getName().endsWith(".vs.xml") || f.isDirectory();
                }

                /**
                 * The description of this filter. For example: "JPG and GIF Images"
                 *
                 * @see javax.swing.filechooser.FileView#getName
                 */
                public String getDescription() {
                    return "UniVis Schema (*.vs.xml)";
                }
            });

            int option = fileChooser.showOpenDialog(VExplorer.this);

            if (option == JFileChooser.APPROVE_OPTION) {
                File file = fileChooser.getSelectedFile();
                new SchemaImport(file);
                refreshTree();
                JOptionPane.showMessageDialog(VExplorer.this, "Schema Import erfolgreich beendet.",
                        "Schema Import", JOptionPane.INFORMATION_MESSAGE);
            }
        }
    });
    program.add(schemaImport);
    program.addSeparator();

    VMenuItem exit = new VMenuItem(Constants.EXIT, VIcons.EXIT);
    exit.setAccelerator(KeyStroke.getKeyStroke('Q', Event.ALT_MASK));
    exit.addActionListener(new ActionListener() {
        /**
         * Invoked when an action occurs.
         */
        public void actionPerformed(ActionEvent e) {
            System.exit(0);
        }
    });
    program.add(exit);

    VMenu lafMenu = new VMenu(Constants.LOOK_AND_FEEL);

    ButtonGroup lafGroup = new ButtonGroup();
    for (final UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
        JRadioButtonMenuItem lafMenuItem = new JRadioButtonMenuItem(laf.getName());

        // Set the current Look And Feel as selected.
        if (UIManager.getLookAndFeel().getName().equals(laf.getName())) {
            lafMenuItem.setSelected(true);
        }

        lafMenuItem.addActionListener(new ActionListener() {
            /**
             * Invoked when an action occurs.
             */
            public void actionPerformed(ActionEvent e) {
                updateLookAndFeel(laf.getClassName());
            }
        });

        lafGroup.add(lafMenuItem);
        lafMenu.add(lafMenuItem);
    }

    JMenu questionMark = new JMenu("?");

    VMenuItem license = new VMenuItem(Constants.LICENSE);
    license.addActionListener(new ActionListener() {

        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            new LicenseDialog(VExplorer.this);
        }
    });
    questionMark.add(license);

    final VMenuItem about = new VMenuItem(Constants.ABOUT, VIcons.INFORMATION);
    about.addActionListener(new ActionListener() {

        /**
         * {@inheritDoc}
         */
        public void actionPerformed(ActionEvent e) {
            new AboutPanel(VExplorer.this);
        }
    });
    questionMark.add(about);

    menuBar.add(program);
    menuBar.add(lafMenu);
    menuBar.add(questionMark);

    setJMenuBar(menuBar);
}

From source file:unikn.dbis.univis.explorer.VExplorer.java

License:asdf

private void makeChartsMenu() {

    makeActionListenerCharts(barChartHorizontal, ChartType.BAR_CHART_HORIZONTAL, "barChartHorizontal");
    makeActionListenerCharts(barChartVertical, ChartType.BAR_CHART_VERTICAL, "barChartVertical");
    makeActionListenerCharts(pieChart, ChartType.PIE_CHART, "pieChart");
    makeActionListenerCharts(areaChart, ChartType.AREA_CHART, "areaChart");
    makeActionListenerCharts(ringChart, ChartType.RING_CHART, "ringChart");

    pivotTable.addActionListener(new ActionListener() {
        /**/*from w w w .  j av a  2 s.c o m*/
         * Invoked when an action occurs.
         */
        public void actionPerformed(ActionEvent e) {

            if (pivotCheck == false) {
                visualizable.clear();
            }
            whatChartLabel.setI18NKey("pivottable");
            setVisualization(new VPivotTable());
            pivotCheck = true;
        }
    });

    ButtonGroup charts = new ButtonGroup();
    barChartHorizontal.setSelected(true);
    charts.add(barChartHorizontal);
    charts.add(barChartVertical);
    charts.add(pieChart);
    charts.add(areaChart);
    charts.add(ringChart);
    charts.add(pivotTable);

    chartsMenu.add(barChartHorizontal);
    chartsMenu.add(barChartVertical);
    chartsMenu.add(pieChart);
    chartsMenu.add(areaChart);
    chartsMenu.add(ringChart);
    chartsMenu.add(pivotTable);
}