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();
}
});
}
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;
}
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;
}
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;
}
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;
}
Aggregations