import java.awt.Color;
import javax.swing.JFormattedTextField;
import javax.swing.JSpinner;
publicclass Main {
publicstaticvoid main(String[] argv) throws Exception {
JSpinner spinner = new JSpinner();
// Disable keyboard edits in the spinner
JFormattedTextField tf = ((JSpinner.DefaultEditor) spinner.getEditor()).getTextField();
tf.setEditable(false);
tf.setBackground(Color.white);
// The value of the spinner can still be programmatically changed
spinner.setValue(newInteger(100));
}
}