I am creating time picker using the spinner.In that the text inside the spinner is editable.But i want to set the spinner as non editable.Because is there chance to give invalid value.Can any one help me.?
+3
A:
Try the following:
JSpinner spinner = ...;
((DefaultEditor) spinner.getEditor()).getTextField().setEditable(false);
This should work as long as you didn't change the spinner editor yourself by calling spinner.setEditor(...)
.
Tell us if this helps.
jfpoilpret
2010-05-25 05:37:50
I modified your code,It works Fine. JSpinner ampm=new JSpinner(); JFormattedTextField ampmspin=((JSpinner.DefaultEditor)ampm.getEditor()).getTextField(); ampmspin.setEditable(false);Thank you very much.........
Arivu2020
2010-06-16 12:18:24