How do you add zero padding to a JSpinner
?
Since the spinner creates the JFormattedTextField
itself, I can't just pass the format into the JFormattedTextField constructor.
Isn't there a way to set the formatting on an existing JFormattedTextField
?
What I want: value = 37, editor = "0037"
UPDATE:
I have tried this as suggested:
JSpinner mySpinner = new JSpinner();
mySpinner.setEditor(
new JSpinner.NumberEditor(mySpinner, "####"));
and the result is no change at all to the presentation of the spinner's data. It seems like a reasonable solution; has anyone tried this successfully so I can be sure it's just something flaky in my own application?