Search in sources :

Example 1 with SpinnerDateModel

use of javax.swing.SpinnerDateModel 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 2 with SpinnerDateModel

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

the class SleepNodeDialog method waitForTimePanel.

private void waitForTimePanel() {
    m_waitForSpinnerModel = new SpinnerDateModel();
    m_forSpinner = new JSpinner(m_waitForSpinnerModel);
    m_forSpinner.setEditor(new JSpinner.DateEditor(m_forSpinner, "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_waitForSpinnerModel.setValue(cal.getTime());
    m_forRB = new JRadioButton("Wait for time:");
    m_forRB.doClick();
    m_forRB.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            if (m_forRB.isSelected()) {
                m_selection = 0;
            }
            m_forSpinner.setEnabled(m_forRB.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)

Aggregations

ItemEvent (java.awt.event.ItemEvent)2 ItemListener (java.awt.event.ItemListener)2 Calendar (java.util.Calendar)2 JRadioButton (javax.swing.JRadioButton)2 JSpinner (javax.swing.JSpinner)2 SpinnerDateModel (javax.swing.SpinnerDateModel)2