Question

Is there anyway to remove the comma from the Jspinner, i'm trying to use it as input for the year but it displays 2011 as 2,011. thanks for the help.

Was it helpful?

Solution

Set the spinner to use a SpinnerDateModel.

OTHER TIPS

I think this is an easier solution :

JSpinner.NumberEditor editor = new JSpinner.NumberEditor(mySpinner, "#");
mySpinner.setEditor(editor);

Or you can do these in Netbeans in few clicks.

select the jspinner component (the one you dragged)

properties >> editor >> change the type to Number and format to 0000.

:D

JSpinner.NumberEditor editor = new JSpinner.NumberEditor( spinner, "#" );
spinner.setEditor( editor );

Hope this will help you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top