IKSDEY IKSDEY - 1 year ago 92
Java Question

Add a string following the value in a JSpinner

Is it possible to add a character or a String after the value in a

(something like "xxx€", "xxx months", xxx being the value) ?

Answer Source

Check out the section from the Swing tutorial on Specifiying Spinner Formatting.

The default editor of the spinner is a JFormattedTextField. So you can access this and set your own formatting.

If you have never used a JFormattedTextField before then the tutorial also has a section on How to Use Formatted Text Fields to help you in creating the mask you want to use.