Search in sources :

Example 76 with SpinnerNumberModel

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

the class DefaultAlphaColorPanel method buildChooser.

/**
 * {@inheritDoc}
 */
@Override
protected void buildChooser() {
    super.setLayout(new BorderLayout());
    m_slider = new JSlider(JSlider.HORIZONTAL, 0, 255, 255);
    m_slider.setMajorTickSpacing(85);
    m_slider.setMinorTickSpacing(17);
    m_slider.setPaintTicks(true);
    m_slider.setPaintLabels(true);
    m_spinner = new JSpinner(new SpinnerNumberModel(255, 0, 255, 5));
    JPanel spinnerPanel = new JPanel(new FlowLayout());
    spinnerPanel.add(m_spinner);
    super.add(new JLabel("Alpha "), BorderLayout.WEST);
    super.add(m_slider, BorderLayout.CENTER);
    super.add(spinnerPanel, BorderLayout.EAST);
    super.add(new JLabel("\n(Alpha composition is " + "expensive in cases when operations performed are not " + "hardware-accelerated.)"), BorderLayout.SOUTH);
    m_slider.addChangeListener(new ChangeListener() {

        public void stateChanged(final ChangeEvent e) {
            setAlpha(m_slider.getValue());
        }
    });
    m_spinner.addChangeListener(new ChangeListener() {

        public void stateChanged(final ChangeEvent e) {
            try {
                m_spinner.commitEdit();
                setAlpha((Integer) m_spinner.getValue());
            } catch (ParseException pe) {
                setAlpha(255);
            }
        }
    });
    m_slider.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(final FocusEvent fe) {
            getAlpha();
        }
    });
    m_spinner.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(final FocusEvent fe) {
            getAlpha();
        }
    });
}
Also used : JPanel(javax.swing.JPanel) FocusAdapter(java.awt.event.FocusAdapter) FlowLayout(java.awt.FlowLayout) JLabel(javax.swing.JLabel) FocusEvent(java.awt.event.FocusEvent) SpinnerNumberModel(javax.swing.SpinnerNumberModel) BorderLayout(java.awt.BorderLayout) ChangeEvent(javax.swing.event.ChangeEvent) JSlider(javax.swing.JSlider) JSpinner(javax.swing.JSpinner) ChangeListener(javax.swing.event.ChangeListener) ParseException(java.text.ParseException)

Example 77 with SpinnerNumberModel

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

the class TwoColumnProperties method createRangeBox.

/**
 * Creates the necessary graphical components for adjusting the displayed
 * column ranges.
 * @return the box containing the graphical components for the column ranges
 * adjustment
 */
private Box createRangeBox() {
    m_xMinSpinner = new JSpinner(new SpinnerNumberModel(1.0, null, null, 0.1));
    m_xMaxSpinner = new JSpinner(new SpinnerNumberModel(1.0, null, null, 0.1));
    m_yMinSpinner = new JSpinner(new SpinnerNumberModel(1.0, null, null, 0.1));
    m_yMaxSpinner = new JSpinner(new SpinnerNumberModel(1.0, null, null, 0.1));
    Dimension spinnerSize = new Dimension(100, m_xMinSpinner.getPreferredSize().height);
    m_xMinSpinner.setPreferredSize(spinnerSize);
    m_xMaxSpinner.setPreferredSize(spinnerSize);
    m_yMinSpinner.setPreferredSize(spinnerSize);
    m_yMaxSpinner.setPreferredSize(spinnerSize);
    Box xBox = Box.createHorizontalBox();
    xBox.add(Box.createHorizontalStrut(SMALL_SPACE));
    xBox.add(new JLabel("X attribute"));
    xBox.add(Box.createHorizontalStrut(SPACE));
    xBox.add(m_xMinSpinner);
    xBox.add(Box.createHorizontalStrut(SPACE));
    xBox.add(m_xMaxSpinner);
    xBox.add(Box.createHorizontalStrut(SMALL_SPACE));
    Box yBox = Box.createHorizontalBox();
    yBox.add(Box.createHorizontalStrut(SMALL_SPACE));
    yBox.add(new JLabel("Y attribute"));
    yBox.add(Box.createHorizontalStrut(SPACE));
    yBox.add(m_yMinSpinner);
    yBox.add(Box.createHorizontalStrut(SPACE));
    yBox.add(m_yMaxSpinner);
    yBox.add(Box.createHorizontalStrut(SMALL_SPACE));
    Box rangeBox = Box.createVerticalBox();
    rangeBox.add(Box.createVerticalStrut(SMALL_SPACE));
    rangeBox.add(xBox);
    rangeBox.add(Box.createVerticalStrut(SPACE));
    rangeBox.add(yBox);
    rangeBox.add(Box.createVerticalStrut(SMALL_SPACE));
    rangeBox.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
    return rangeBox;
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) JSpinner(javax.swing.JSpinner) JLabel(javax.swing.JLabel) Box(javax.swing.Box) ColumnSelectionComboxBox(org.knime.core.node.util.ColumnSelectionComboxBox) Dimension(java.awt.Dimension)

Example 78 with SpinnerNumberModel

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

the class LinReg2LearnerNodeDialogPane method createRegressionPropertiesPanel.

private JPanel createRegressionPropertiesPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 0;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.BASELINE;
    c.insets = new Insets(5, 5, 0, 0);
    m_predefinedOffsetValue = new JCheckBox("Predefined Offset Value:");
    panel.add(m_predefinedOffsetValue, c);
    c.gridx++;
    m_offsetValue = new JSpinner(new SpinnerNumberModel(0.0, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 1.0));
    m_offsetValue.setPreferredSize(new Dimension(m_offsetValue.getPreferredSize().width + 70, m_offsetValue.getPreferredSize().height));
    panel.add(m_offsetValue, c);
    m_predefinedOffsetValue.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            m_offsetValue.setEnabled(m_predefinedOffsetValue.isSelected());
        }
    });
    return panel;
}
Also used : JCheckBox(javax.swing.JCheckBox) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JSpinner(javax.swing.JSpinner) Dimension(java.awt.Dimension)

Example 79 with SpinnerNumberModel

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

the class LinReg2LearnerNodeDialogPane method createScatterPlotPropertiesPanel.

private JPanel createScatterPlotPropertiesPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.BASELINE;
    c.insets = new Insets(5, 5, 0, 0);
    panel.add(new JLabel("First Row:"), c);
    c.gridx++;
    m_scatterPlotFirstRow = new JSpinner(new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1));
    m_scatterPlotFirstRow.setPreferredSize(new Dimension(m_scatterPlotFirstRow.getPreferredSize().width - 50, m_scatterPlotFirstRow.getPreferredSize().height));
    panel.add(m_scatterPlotFirstRow, c);
    c.gridy++;
    c.gridx = 0;
    c.insets = new Insets(5, 5, 0, 0);
    panel.add(new JLabel("Row Count:"), c);
    c.gridx++;
    c.insets = new Insets(5, 5, 0, 0);
    m_scatterPlotRowCount = new JSpinner(new SpinnerNumberModel(20000, 1, Integer.MAX_VALUE, 1));
    m_scatterPlotRowCount.setPreferredSize(new Dimension(m_scatterPlotRowCount.getPreferredSize().width - 50, m_scatterPlotRowCount.getPreferredSize().height));
    panel.add(m_scatterPlotRowCount, c);
    return panel;
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) JSpinner(javax.swing.JSpinner) Dimension(java.awt.Dimension)

Example 80 with SpinnerNumberModel

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

the class DecTreeToImageNodeDialog method createUnfoldMethodPanel.

private JPanel createUnfoldMethodPanel() {
    JPanel p = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.BASELINE;
    c.insets = new Insets(2, 2, 2, 2);
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.weightx = 0;
    c.weighty = 0;
    Insets leftInsets = new Insets(3, 0, 3, 8);
    Insets rightInsets = new Insets(3, 0, 3, 0);
    Insets leftCategoryInsets = new Insets(0, 0, 3, 8);
    Insets rightCategoryInsets = new Insets(0, 0, 3, 0);
    ActionListener unfoldMethodListener = new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            updateUnfoldOptions();
        }
    };
    c.gridx = 0;
    c.insets = leftCategoryInsets;
    c.gridwidth = 1;
    c.weightx = 0;
    m_unfoldMethodCoverage = new JRadioButton("Unfold with data coverage:");
    m_unfoldMethodCoverage.addActionListener(unfoldMethodListener);
    p.add(m_unfoldMethodCoverage, c);
    c.gridx = 1;
    c.insets = rightCategoryInsets;
    c.weightx = 1;
    m_unfoldWithCoverage = new JTextField();
    p.add(m_unfoldWithCoverage, c);
    c.gridy++;
    c.gridx = 0;
    c.insets = leftInsets;
    c.gridwidth = 1;
    c.weightx = 0;
    m_unfoldMethodLevel = new JRadioButton("Unfold to level:");
    m_unfoldMethodLevel.addActionListener(unfoldMethodListener);
    p.add(m_unfoldMethodLevel, c);
    c.gridx = 1;
    c.insets = rightInsets;
    c.weightx = 1;
    m_unfoldToLevel = new JSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1));
    p.add(m_unfoldToLevel, c);
    m_unfoldMethod = new ButtonGroup();
    m_unfoldMethod.add(m_unfoldMethodLevel);
    m_unfoldMethod.add(m_unfoldMethodCoverage);
    return p;
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JRadioButton(javax.swing.JRadioButton) GridBagLayout(java.awt.GridBagLayout) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) ActionEvent(java.awt.event.ActionEvent) JSpinner(javax.swing.JSpinner) JTextField(javax.swing.JTextField)

Aggregations

SpinnerNumberModel (javax.swing.SpinnerNumberModel)84 JSpinner (javax.swing.JSpinner)63 JLabel (javax.swing.JLabel)41 JPanel (javax.swing.JPanel)40 ActionEvent (java.awt.event.ActionEvent)35 GridBagLayout (java.awt.GridBagLayout)25 Dimension (java.awt.Dimension)22 ActionListener (java.awt.event.ActionListener)22 ChangeEvent (javax.swing.event.ChangeEvent)19 Insets (java.awt.Insets)17 GridBagConstraints (java.awt.GridBagConstraints)16 JRadioButton (javax.swing.JRadioButton)16 JCheckBox (javax.swing.JCheckBox)15 ButtonGroup (javax.swing.ButtonGroup)12 ChangeListener (javax.swing.event.ChangeListener)12 JButton (javax.swing.JButton)11 JTextField (javax.swing.JTextField)10 BorderLayout (java.awt.BorderLayout)8 BoxLayout (javax.swing.BoxLayout)7 FormLayout (com.jgoodies.forms.layout.FormLayout)6