I've a Jspinner that can vary from minimum
to maximum
at steps of 0.1
. This is working perfectly fine. Now, I set the editor of JSpinner
as NumberEditor
as the user can edit the textbox and I want only numeric values from this. This is also working, that is whatever the user may enter, the editor gives me only the numbers in the editor when I get the value using mySpinner.getValue().toString();
. Now cones the problem. I want the textbox to accept only numeric values and .(decimal point)
, that is, if the user tries to enter anything apart from 0-9
and .
, it should not echo it in the textbox.
JSpinner mySpinner = new JSpinner();
mySpinner.setModel(new SpinnerNumberModel(default,minimum,maximum,0.1));
mySpinner.setEditor(new JSpinner.NumberEditor(mySpinner,"##.#"));
Can someone help me with this. Thanks :)
0.1
, that problem was solved. Thanks :) – Stun