Search in sources :

Example 31 with JSpinner

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

the class CategoryToNumberNodeDialogPane method createCategoryToNumberSettingsTab.

@SuppressWarnings("unchecked")
private JPanel createCategoryToNumberSettingsTab() {
    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.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.weightx = 1;
    c.weighty = 0;
    Insets leftInsets = new Insets(3, 8, 3, 8);
    Insets middleInsets = new Insets(3, 0, 3, 0);
    c.gridwidth = 3;
    m_filterPanel = new DataColumnSpecFilterPanel();
    p.add(m_filterPanel, c);
    c.weighty = 0;
    c.weightx = 0;
    c.gridy++;
    c.gridwidth = 2;
    c.gridx = 0;
    c.insets = leftInsets;
    m_appendColums = new JCheckBox("Append columns");
    m_appendColums.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            m_columnSuffix.setEnabled(m_appendColums.isSelected());
        }
    });
    p.add(m_appendColums, c);
    c.gridy++;
    c.gridwidth = 1;
    c.gridx = 0;
    c.insets = leftInsets;
    p.add(new JLabel("Column suffix:"), c);
    c.gridx = 1;
    c.insets = middleInsets;
    m_columnSuffix = new JTextField();
    p.add(m_columnSuffix, c);
    c.gridy++;
    c.gridwidth = 1;
    c.gridx = 0;
    c.insets = leftInsets;
    p.add(new JLabel("Start value:"), c);
    c.gridx = 1;
    c.insets = middleInsets;
    m_startIndex = new JSpinner(new SpinnerNumberModel(0, Integer.MIN_VALUE, Integer.MAX_VALUE, 1));
    p.add(m_startIndex, c);
    c.gridy++;
    c.gridwidth = 1;
    c.gridx = 0;
    c.insets = leftInsets;
    p.add(new JLabel("Increment:"), c);
    c.gridx = 1;
    c.insets = middleInsets;
    m_increment = new JSpinner(new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1));
    p.add(m_increment, c);
    c.gridy++;
    c.gridwidth = 1;
    c.gridx = 0;
    c.insets = leftInsets;
    p.add(new JLabel("Max. categories:"), c);
    c.gridx = 1;
    c.insets = middleInsets;
    m_maxCategories = new JSpinner(new SpinnerNumberModel(1000, 1, Integer.MAX_VALUE, 100));
    p.add(m_maxCategories, c);
    c.gridy++;
    c.gridwidth = 1;
    c.gridx = 0;
    c.insets = leftInsets;
    p.add(new JLabel("Default value:"), c);
    c.gridx = 1;
    c.insets = middleInsets;
    m_defaultValue = new JTextField();
    m_defaultValue.setHorizontalAlignment(SwingConstants.RIGHT);
    p.add(m_defaultValue, c);
    c.gridy++;
    c.gridwidth = 1;
    c.gridx = 0;
    c.insets = leftInsets;
    p.add(new JLabel("Map missing to:"), c);
    c.gridx = 1;
    c.insets = middleInsets;
    m_mapMissingTo = new JTextField();
    m_mapMissingTo.setHorizontalAlignment(SwingConstants.RIGHT);
    p.add(m_mapMissingTo, c);
    c.gridy++;
    c.weighty = 1;
    p.add(new JPanel(), c);
    return p;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) JCheckBox(javax.swing.JCheckBox) SpinnerNumberModel(javax.swing.SpinnerNumberModel) DataColumnSpecFilterPanel(org.knime.core.node.util.filter.column.DataColumnSpecFilterPanel) ActionListener(java.awt.event.ActionListener) JSpinner(javax.swing.JSpinner)

Example 32 with JSpinner

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

the class AbstractCorrelationComputeNodeView 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)

Example 33 with JSpinner

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

the class SleepNodeDialog method waitToTimePanel.

private void waitToTimePanel() {
    m_waitToSpinnerModel = new SpinnerDateModel();
    m_toSpinner = new JSpinner(m_waitToSpinnerModel);
    m_toSpinner.setEditor(new JSpinner.DateEditor(m_toSpinner, "HH:mm:ss"));
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    m_waitToSpinnerModel.setValue(cal.getTime());
    m_toRB = new JRadioButton("Wait to time:");
    m_toRB.doClick();
    m_toRB.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            if (m_toRB.isSelected()) {
                m_selection = 1;
            }
            m_toSpinner.setEnabled(m_toRB.isSelected());
        }
    });
}
Also used : ItemEvent(java.awt.event.ItemEvent) JRadioButton(javax.swing.JRadioButton) Calendar(java.util.Calendar) JSpinner(javax.swing.JSpinner) ItemListener(java.awt.event.ItemListener) SpinnerDateModel(javax.swing.SpinnerDateModel)

Example 34 with JSpinner

use of javax.swing.JSpinner in project jgnash by ccavanaugh.

the class GeneralOptions method initComponents.

private void initComponents() {
    animationsEnabled = new JCheckBox(rb.getString("Button.SubstanceAnimations"));
    numButton = new JButton(rb.getString("Menu.EditTranNumList.Name"));
    selectOnFocusCheckBox = new JCheckBox(rb.getString("Button.SelectText"));
    SpinnerModel model = new SpinnerNumberModel(ThemeManager.getNimbusFontSize(), 9, 15, 1);
    nimbusFontSpinner = new JSpinner(model);
}
Also used : JCheckBox(javax.swing.JCheckBox) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JButton(javax.swing.JButton) JSpinner(javax.swing.JSpinner) SpinnerModel(javax.swing.SpinnerModel)

Example 35 with JSpinner

use of javax.swing.JSpinner in project FBReaderJ by geometer.

the class ZLSpinOptionView method createItem.

protected void createItem() {
    final ZLSpinOptionEntry option = (ZLSpinOptionEntry) myOption;
    mySpinner = new JSpinner(new SpinnerNumberModel(option.initialValue(), option.minValue(), option.maxValue(), option.getStep()));
    if (myName == null || "".equals(myName)) {
        myLabel = null;
        myTab.insertWidget(mySpinner);
    } else {
        JPanel panel1 = new JPanel();
        panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));
        mySpinner.setMaximumSize(new Dimension(mySpinner.getMaximumSize().width, mySpinner.getPreferredSize().height));
        panel1.add(mySpinner);
        myLabel = new JLabel(myName);
        JPanel panel2 = new JPanel(new BorderLayout());
        panel2.add(myLabel, BorderLayout.LINE_END);
        myPanel = new JPanel(new GridLayout(1, 2, 10, 0));
        myPanel.add(panel2);
        myPanel.add(panel1);
        myTab.insertWidget(myPanel);
    }
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) ZLSpinOptionEntry(org.geometerplus.zlibrary.core.dialogs.ZLSpinOptionEntry) BoxLayout(javax.swing.BoxLayout) JSpinner(javax.swing.JSpinner) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

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