0

I'm currently having a problem in netbeans where my JSpinner is allowing you to type in the textfield while I only want the arrows to be used. Is there a way to disable the input of text via properties or some other way?

Thanks

Dylan
  • 1
  • 6

2 Answers2

3

Disable the JSpinner's JTextField's using the following:

((JSpinner.DefaultEditor) yourSpinner.getEditor()).getTextField().setEditable(false);
chrissukhram
  • 2,957
  • 1
  • 13
  • 13
0

You can try it like this

 JSpinner.DefaultEditor editor = ( JSpinner.DefaultEditor ) component.getEditor();
editor.getTextField().setEnabled( true );
editor.getTextField().setEditable( false );
René Winkler
  • 6,508
  • 7
  • 42
  • 69