I needed a widget to select a TCP/UDP port, so I wrote the following:
public static JSpinner makePortSpinner()
{
final JSpinner spinner = new JSpinner(
new SpinnerNumberModel( DefaultPort, 1024, 65535, 1 ) );
spinner.setFont( Monospaced );
return spinner;
}
...Monospaced
and DefaultPort
being static constants.
I would like to remove the digit grouping characters from the resulting display. For example, the default of 55024 displays as "55,024", where I would like it to be "55024". I know that straight NumberFormat
, as I might use with JFormattedTextField
, has a setGroupingUsed(boolean)
method for this purpose. Is there anything like this for JSpinner
? Should I subclass SpinnerNumberModel
?