Search in sources :

Example 56 with JRadioButton

use of javax.swing.JRadioButton in project knime-core by knime.

the class AutoBinnerLearnNodeDialogPane method createBinNamingUIControls.

private JPanel createBinNamingUIControls() {
    JPanel p = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new Insets(2, 2, 2, 2);
    c.gridy = 0;
    c.gridx = 0;
    c.weightx = 0;
    c.gridwidth = 2;
    m_binNamingNumbered = new JRadioButton("Numbered");
    p.add(m_binNamingNumbered, c);
    c.gridx = 2;
    c.gridwidth = 1;
    c.weightx = 1;
    c.insets = new Insets(6, 2, 2, 2);
    JLabel exampleNumbered = new JLabel("e.g.: Bin 1, Bin 2, Bin 3");
    exampleNumbered.setEnabled(false);
    p.add(exampleNumbered, c);
    c.weightx = 0;
    c.insets = new Insets(2, 2, 2, 2);
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 1;
    m_binNamingEdges = new JRadioButton("Borders");
    p.add(m_binNamingEdges, c);
    c.gridx = 1;
    c.gridwidth = 2;
    c.weightx = 1;
    c.insets = new Insets(6, 2, 2, 2);
    JLabel exampleEdges = new JLabel("e.g.: [-10,0], (0,10], (10,20]");
    exampleEdges.setEnabled(false);
    p.add(exampleEdges, c);
    c.weightx = 0;
    c.insets = new Insets(2, 2, 2, 2);
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 1;
    m_binNamingMidpoints = new JRadioButton("Midpoints");
    p.add(m_binNamingMidpoints, c);
    c.gridx = 1;
    c.gridwidth = 2;
    c.weightx = 1;
    c.insets = new Insets(6, 2, 2, 2);
    JLabel exampleMidpoints = new JLabel("e.g.: -5, 5, 15");
    exampleMidpoints.setEnabled(false);
    p.add(exampleMidpoints, c);
    c.weightx = 0;
    c.insets = new Insets(2, 2, 2, 2);
    ButtonGroup method = new ButtonGroup();
    method.add(m_binNamingNumbered);
    method.add(m_binNamingEdges);
    method.add(m_binNamingMidpoints);
    p.setBorder(BorderFactory.createTitledBorder("Bin Naming"));
    return p;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JRadioButton(javax.swing.JRadioButton) GridBagLayout(java.awt.GridBagLayout) ButtonGroup(javax.swing.ButtonGroup) JLabel(javax.swing.JLabel)

Example 57 with JRadioButton

use of javax.swing.JRadioButton in project knime-core by knime.

the class AutoBinnerLearnNodeDialogPane method createMethodUIControls.

private JPanel createMethodUIControls() {
    JPanel p = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new Insets(2, 2, 2, 2);
    c.weightx = 0;
    c.gridy = 0;
    c.gridx = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    m_methodFixedNumber = new JRadioButton("Fixed number of bins");
    m_methodFixedNumber.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            m_numBins.setEnabled(m_methodFixedNumber.isSelected());
            m_sampleQuantiles.setEnabled(!m_methodFixedNumber.isSelected());
        }
    });
    p.add(m_methodFixedNumber, c);
    c.gridy++;
    JPanel numBinsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
    numBinsPanel.add(new JLabel("Number of bins:"));
    m_numBins = new JSpinner(new SpinnerNumberModel(5, 1, Integer.MAX_VALUE, 1));
    numBinsPanel.add(m_numBins);
    numBinsPanel.setBorder(BorderFactory.createEmptyBorder(0, 17, 0, 0));
    p.add(numBinsPanel, c);
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    m_methodSampleQuantiles = new JRadioButton("Sample quantiles");
    m_methodSampleQuantiles.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent e) {
            m_numBins.setEnabled(!m_methodSampleQuantiles.isSelected());
            m_sampleQuantiles.setEnabled(m_methodSampleQuantiles.isSelected());
        }
    });
    p.add(m_methodSampleQuantiles, c);
    c.gridy++;
    JPanel quantilesPanel = new JPanel(new GridBagLayout());
    int gridy = c.gridy;
    c.gridy = 0;
    c.gridwidth = 1;
    quantilesPanel.add(new JLabel("Quantiles (comma separated):"), c);
    c.gridx++;
    c.gridwidth = 1;
    c.weightx = 1;
    m_sampleQuantiles = new JTextField();
    quantilesPanel.add(m_sampleQuantiles, c);
    quantilesPanel.setBorder(BorderFactory.createEmptyBorder(0, 17, 0, 0));
    c.gridy = gridy;
    c.gridx = 0;
    c.gridwidth = 1;
    p.add(quantilesPanel, c);
    ButtonGroup method = new ButtonGroup();
    method.add(m_methodFixedNumber);
    method.add(m_methodSampleQuantiles);
    p.setBorder(BorderFactory.createTitledBorder("Binning Method"));
    return p;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JRadioButton(javax.swing.JRadioButton) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) SpinnerNumberModel(javax.swing.SpinnerNumberModel) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) JSpinner(javax.swing.JSpinner)

Example 58 with JRadioButton

use of javax.swing.JRadioButton in project knime-core by knime.

the class AutoBinnerLearnNodeDialogPane method createBinNamingUIControls.

private JPanel createBinNamingUIControls() {
    JPanel p = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new Insets(2, 2, 2, 2);
    c.gridy = 0;
    c.gridx = 0;
    c.weightx = 0;
    c.gridwidth = 2;
    m_binNamingNumbered = new JRadioButton("Numbered");
    p.add(m_binNamingNumbered, c);
    c.gridx = 2;
    c.gridwidth = 1;
    c.weightx = 1;
    c.insets = new Insets(6, 2, 2, 2);
    JLabel exampleNumbered = new JLabel("e.g.: Bin 1, Bin 2, Bin 3");
    exampleNumbered.setEnabled(false);
    p.add(exampleNumbered, c);
    c.weightx = 0;
    c.insets = new Insets(2, 2, 2, 2);
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 1;
    m_binNamingEdges = new JRadioButton("Borders");
    p.add(m_binNamingEdges, c);
    c.gridx = 1;
    c.gridwidth = 2;
    c.weightx = 1;
    c.insets = new Insets(6, 2, 2, 2);
    JLabel exampleEdges = new JLabel("e.g.: [-10,0], (0,10], (10,20]");
    exampleEdges.setEnabled(false);
    p.add(exampleEdges, c);
    c.weightx = 0;
    c.insets = new Insets(2, 2, 2, 2);
    ButtonGroup method = new ButtonGroup();
    method.add(m_binNamingNumbered);
    method.add(m_binNamingEdges);
    p.setBorder(BorderFactory.createTitledBorder("Bin Naming"));
    return p;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JRadioButton(javax.swing.JRadioButton) GridBagLayout(java.awt.GridBagLayout) ButtonGroup(javax.swing.ButtonGroup) JLabel(javax.swing.JLabel)

Example 59 with JRadioButton

use of javax.swing.JRadioButton in project knime-core by knime.

the class MissingValueHandling2Panel method createEastLayout.

/**
 * @param setting
 * @param panel
 * @param spec
 */
private void createEastLayout(final MissingValueHandling2ColSetting setting, final JPanel panel, final DataColumnSpec... spec) {
    ButtonGroup buttonGroup = new ButtonGroup();
    ActionListener actionListener = new ButtonListener();
    // NO HANDLING Button
    m_nothingButton = new JRadioButton("Do Nothing");
    m_nothingButton.setToolTipText("No missing value handling.");
    m_nothingButton.addActionListener(actionListener);
    buttonGroup.add(m_nothingButton);
    panel.add(m_nothingButton);
    // REMOVE Button
    m_removeButton = new JRadioButton("Remove Row");
    m_removeButton.setToolTipText("Ignore rows that contain a " + "missing value");
    m_removeButton.addActionListener(actionListener);
    buttonGroup.add(m_removeButton);
    panel.add(m_removeButton);
    if (setting.getType() == MissingValueHandling2ColSetting.TYPE_DOUBLE || setting.getType() == MissingValueHandling2ColSetting.TYPE_INT) {
        // MIN Button
        m_minButton = new JRadioButton("Min");
        m_minButton.setToolTipText("Replaces missing values by the minimum " + "of the values in a column");
        m_minButton.addActionListener(actionListener);
        buttonGroup.add(m_minButton);
        panel.add(m_minButton);
        // MAX Button
        m_maxButton = new JRadioButton("Max");
        m_maxButton.setToolTipText("Replaces missing values by the " + "maximum of the values in a column");
        m_maxButton.addActionListener(actionListener);
        buttonGroup.add(m_maxButton);
        panel.add(m_maxButton);
        // MEAN Button
        m_meanButton = new JRadioButton("Mean");
        m_meanButton.setToolTipText("Replaces missing values by the mean " + "of the values in a column");
        m_meanButton.addActionListener(actionListener);
        buttonGroup.add(m_meanButton);
        panel.add(m_meanButton);
        if (setting.getType() == MissingValueHandling2ColSetting.TYPE_DOUBLE) {
            // even number of components
            panel.add(new JLabel());
        }
    } else {
        m_meanButton = null;
        m_minButton = null;
        m_maxButton = null;
    }
    if (setting.getType() == MissingValueHandling2ColSetting.TYPE_INT || setting.getType() == MissingValueHandling2ColSetting.TYPE_STRING) {
        m_mostFrequentButton = new JRadioButton("Most Frequent");
        m_mostFrequentButton.setToolTipText("Replaces missing values " + "by the most frequent value in a column");
        m_mostFrequentButton.addActionListener(actionListener);
        buttonGroup.add(m_mostFrequentButton);
        panel.add(m_mostFrequentButton);
        if (setting.getType() == MissingValueHandling2ColSetting.TYPE_STRING) {
            // even number of components
            panel.add(new JLabel());
        }
    } else {
        m_mostFrequentButton = null;
    }
    if (setting.getType() != MissingValueHandling2ColSetting.TYPE_UNKNOWN) {
        // FIX Button
        m_fixButton = new JRadioButton("Fix Value: ");
        m_fixButton.setToolTipText("Replaces missing values by a fixed value");
        m_fixButton.addActionListener(actionListener);
        buttonGroup.add(m_fixButton);
        panel.add(m_fixButton);
        m_fixText = getFixTextField(setting, spec);
        JPanel fixPanel = new JPanel(new BorderLayout());
        fixPanel.add(minHeight(createSpacer(1)), BorderLayout.NORTH);
        fixPanel.add(ViewUtils.getInFlowLayout(m_fixText), BorderLayout.CENTER);
        fixPanel.add(minHeight(createSpacer(1)), BorderLayout.SOUTH);
        panel.add(fixPanel);
    } else {
        m_fixButton = null;
        m_fixText = null;
    }
    switch(setting.getMethod()) {
        case MissingValueHandling2ColSetting.METHOD_FIX_VAL:
            m_fixButton.doClick();
            break;
        case MissingValueHandling2ColSetting.METHOD_IGNORE_ROWS:
            m_removeButton.doClick();
            break;
        case MissingValueHandling2ColSetting.METHOD_MOST_FREQUENT:
            m_mostFrequentButton.doClick();
            break;
        case MissingValueHandling2ColSetting.METHOD_MAX:
            m_maxButton.doClick();
            break;
        case MissingValueHandling2ColSetting.METHOD_MEAN:
            m_meanButton.doClick();
            break;
        case MissingValueHandling2ColSetting.METHOD_MIN:
            m_minButton.doClick();
            break;
        default:
            m_nothingButton.doClick();
    }
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) ButtonGroup(javax.swing.ButtonGroup) JLabel(javax.swing.JLabel)

Example 60 with JRadioButton

use of javax.swing.JRadioButton in project knime-core by knime.

the class DialogComponentAuthentication method createAuthenticationTypeButton.

private JRadioButton createAuthenticationTypeButton(final AuthenticationType type, final ButtonGroup group, final ActionListener l) {
    boolean contains = m_namingMap.containsKey(type);
    String buttonLabel = contains ? m_namingMap.get(type).getFirst() : type.getText();
    String toolTip = contains ? m_namingMap.get(type).getSecond() : type.getToolTip();
    final JRadioButton button = new JRadioButton(buttonLabel);
    button.setActionCommand(type.getActionCommand());
    if (type.isDefault()) {
        button.setSelected(true);
    }
    if (type.getToolTip() != null) {
        button.setToolTipText(toolTip);
    }
    if (l != null) {
        button.addActionListener(l);
    }
    group.add(button);
    return button;
}
Also used : JRadioButton(javax.swing.JRadioButton)

Aggregations

JRadioButton (javax.swing.JRadioButton)323 ButtonGroup (javax.swing.ButtonGroup)185 JPanel (javax.swing.JPanel)168 JLabel (javax.swing.JLabel)144 ActionEvent (java.awt.event.ActionEvent)104 ActionListener (java.awt.event.ActionListener)95 JTextField (javax.swing.JTextField)81 JButton (javax.swing.JButton)77 BoxLayout (javax.swing.BoxLayout)61 JCheckBox (javax.swing.JCheckBox)59 GridBagLayout (java.awt.GridBagLayout)57 BorderLayout (java.awt.BorderLayout)52 GridBagConstraints (java.awt.GridBagConstraints)52 Insets (java.awt.Insets)51 Dimension (java.awt.Dimension)45 FlowLayout (java.awt.FlowLayout)42 JScrollPane (javax.swing.JScrollPane)41 GridLayout (java.awt.GridLayout)32 JComboBox (javax.swing.JComboBox)32 ItemEvent (java.awt.event.ItemEvent)25