Search in sources :

Example 71 with JSpinner

use of javax.swing.JSpinner 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 72 with JSpinner

use of javax.swing.JSpinner 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)

Example 73 with JSpinner

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

the class AutoBinnerLearnNodeDialogPane method createMethodUIControls.

private JPanel createMethodUIControls(final boolean supportsQuantile) {
    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() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            m_numBins.setEnabled(m_methodFixedNumber.isSelected());
            m_equalityMethod.setEnabled(m_methodFixedNumber.isSelected());
            m_sampleQuantiles.setEnabled(!m_methodFixedNumber.isSelected());
        }
    });
    if (supportsQuantile) {
        p.add(m_methodFixedNumber, c);
    }
    c.gridy++;
    // JPanel numBinsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
    JPanel numBinsPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(2, 2, 2, 2);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 0;
    gbc.weighty = 0;
    gbc.gridx = 0;
    gbc.gridy = 0;
    numBinsPanel.add(new JLabel("Number of bins:"), gbc);
    gbc.gridx++;
    m_numBins = new JSpinner(new SpinnerNumberModel(5, 1, Integer.MAX_VALUE, 1));
    numBinsPanel.add(m_numBins, gbc);
    m_equalityMethod = new JComboBox<EqualityMethod>(EqualityMethod.values());
    if (supportsQuantile) {
        gbc.weightx = 1;
        gbc.gridx++;
        numBinsPanel.add(new JLabel(), gbc);
        gbc.weightx = 0;
        gbc.gridx = 0;
        gbc.gridy++;
        numBinsPanel.add(new JLabel("Equal:"), gbc);
        gbc.gridx++;
        numBinsPanel.add(m_equalityMethod, gbc);
        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() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            m_numBins.setEnabled(!m_methodSampleQuantiles.isSelected());
            m_equalityMethod.setEnabled(!m_methodSampleQuantiles.isSelected());
            m_sampleQuantiles.setEnabled(m_methodSampleQuantiles.isSelected());
        }
    });
    if (supportsQuantile) {
        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;
    if (supportsQuantile) {
        p.add(quantilesPanel, c);
    }
    ButtonGroup method = new ButtonGroup();
    method.add(m_methodFixedNumber);
    method.add(m_methodSampleQuantiles);
    if (supportsQuantile) {
        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) 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) EqualityMethod(org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.EqualityMethod)

Example 74 with JSpinner

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

the class AutoBinnerLearnNodeDialogPane method createNumberFormatSettingsTab.

private JPanel createNumberFormatSettingsTab() {
    JPanel p = new JPanel(new GridBagLayout());
    m_defaultFormatting = new JRadioButton("Default formatting");
    m_advancedFormatting = new JRadioButton("Advanced formatting");
    ButtonGroup formatting = new ButtonGroup();
    formatting.add(m_defaultFormatting);
    formatting.add(m_advancedFormatting);
    m_outputFormat = new JComboBox<OutputFormat>(OutputFormat.values());
    m_precision = new JSpinner(new SpinnerNumberModel(3, 0, Integer.MAX_VALUE, 1));
    m_precisionMode = new JComboBox<PrecisionMode>(PrecisionMode.values());
    m_roundingMode = new JComboBox<RoundingMode>(getRoundingModes());
    ActionListener formattingListener = new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            m_outputFormat.setEnabled(m_advancedFormatting.isSelected());
            m_precision.setEnabled(m_advancedFormatting.isSelected());
            m_precisionMode.setEnabled(m_advancedFormatting.isSelected());
            m_roundingMode.setEnabled(m_advancedFormatting.isSelected());
        }
    };
    m_defaultFormatting.addActionListener(formattingListener);
    m_advancedFormatting.addActionListener(formattingListener);
    GridBagConstraints gbc = new GridBagConstraints();
    Insets indentedInsets = new Insets(5, 15, 5, 5);
    Insets normalInsets = new Insets(5, 5, 5, 5);
    gbc.insets = normalInsets;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 0;
    gbc.weighty = 0;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 2;
    p.add(m_defaultFormatting, gbc);
    gbc.gridy++;
    p.add(m_advancedFormatting, gbc);
    gbc.gridwidth = 1;
    gbc.gridy++;
    gbc.insets = indentedInsets;
    p.add(new JLabel("Output format"), gbc);
    gbc.gridx++;
    gbc.insets = normalInsets;
    p.add(m_outputFormat, gbc);
    gbc.gridx = 0;
    gbc.gridy++;
    gbc.insets = indentedInsets;
    p.add(new JLabel("Precision"), gbc);
    gbc.gridx++;
    gbc.insets = normalInsets;
    p.add(m_precision, gbc);
    gbc.gridx = 0;
    gbc.gridy++;
    gbc.insets = indentedInsets;
    p.add(new JLabel("Precision mode"), gbc);
    gbc.gridx++;
    gbc.insets = normalInsets;
    p.add(m_precisionMode, gbc);
    gbc.gridx = 0;
    gbc.gridy++;
    gbc.insets = indentedInsets;
    p.add(new JLabel("Rounding mode"), gbc);
    gbc.gridx++;
    gbc.insets = normalInsets;
    p.add(m_roundingMode, gbc);
    gbc.gridx++;
    gbc.gridy++;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.insets = new Insets(0, 0, 0, 0);
    p.add(new JLabel(), gbc);
    return p;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) JRadioButton(javax.swing.JRadioButton) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) RoundingMode(java.math.RoundingMode) ActionEvent(java.awt.event.ActionEvent) OutputFormat(org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.OutputFormat) JLabel(javax.swing.JLabel) SpinnerNumberModel(javax.swing.SpinnerNumberModel) PrecisionMode(org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.PrecisionMode) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) JSpinner(javax.swing.JSpinner)

Example 75 with JSpinner

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

the class RankCorrelationComputeNodeView method getJMenu.

private JMenu getJMenu() {
    JMenu menu = new JMenu("View");
    JCheckBoxMenuItem useColorBox = new JCheckBoxMenuItem("Use Colors");
    useColorBox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            if (((JCheckBoxMenuItem) e.getSource()).isSelected()) {
                changeRenderer(ColorRender.DESCRIPTION);
            } else {
                changeRenderer(DoubleValueRenderer.STANDARD_RENDERER.getDescription());
            }
        }
    });
    useColorBox.addPropertyChangeListener("ancestor", new PropertyChangeListener() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void propertyChange(final PropertyChangeEvent evt) {
            ((JCheckBoxMenuItem) evt.getSource()).setSelected(m_currentRendererID.equals(ColorRender.DESCRIPTION));
        }
    });
    JMenuItem colWidthItem = new JMenuItem("Cell Size...");
    colWidthItem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            int colWidth = m_tableView.getColumnWidth();
            JSpinner s = new JSpinner(new SpinnerNumberModel(colWidth, 1, Integer.MAX_VALUE, 1));
            int r = JOptionPane.showConfirmDialog(m_tableView, s, "Cell Size", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
            if (r == JOptionPane.OK_OPTION) {
                m_tableView.setColumnWidth((Integer) s.getValue());
                m_tableView.setRowHeight((Integer) s.getValue());
            }
        }
    });
    menu.add(useColorBox);
    menu.add(colWidthItem);
    return menu;
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) PropertyChangeEvent(java.beans.PropertyChangeEvent) ActionListener(java.awt.event.ActionListener) PropertyChangeListener(java.beans.PropertyChangeListener) ActionEvent(java.awt.event.ActionEvent) JSpinner(javax.swing.JSpinner) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem)

Aggregations

JSpinner (javax.swing.JSpinner)76 SpinnerNumberModel (javax.swing.SpinnerNumberModel)61 JLabel (javax.swing.JLabel)47 JPanel (javax.swing.JPanel)41 ActionEvent (java.awt.event.ActionEvent)28 ActionListener (java.awt.event.ActionListener)27 JCheckBox (javax.swing.JCheckBox)22 JRadioButton (javax.swing.JRadioButton)21 GridBagConstraints (java.awt.GridBagConstraints)18 Insets (java.awt.Insets)18 ChangeEvent (javax.swing.event.ChangeEvent)18 GridBagLayout (java.awt.GridBagLayout)17 JButton (javax.swing.JButton)15 Dimension (java.awt.Dimension)13 ChangeListener (javax.swing.event.ChangeListener)13 ButtonGroup (javax.swing.ButtonGroup)12 BorderLayout (java.awt.BorderLayout)11 JTextField (javax.swing.JTextField)11 JScrollPane (javax.swing.JScrollPane)10 JMenuItem (javax.swing.JMenuItem)8