Example usage for javax.swing JSpinner getEditor

List of usage examples for javax.swing JSpinner getEditor

Introduction

In this page you can find the example usage for javax.swing JSpinner getEditor.

Prototype

public JComponent getEditor() 

Source Link

Document

Returns the component that displays and potentially changes the model's value.

Usage

From source file:org.rockyroadshub.planner.core.gui.calendar.FormPane.java

private void setAllowsInvalid(JSpinner s1, JSpinner s2) {
    JFormattedTextField txt = ((JSpinner.NumberEditor) s1.getEditor()).getTextField();
    ((NumberFormatter) txt.getFormatter()).setAllowsInvalid(false);
    s1.addChangeListener((ChangeEvent e) -> {
        if (s1.getValue().equals(60)) {
            s1.setValue(0);//w  ww. ja  va2  s  .  c o  m
            int i = (int) s2.getValue() + 1;
            s2.setValue(i);
        }
    });
}