I'd like my JTextField, which I use to enter numbers, to have digits grouped (e.g. with a separator char: 1,000,000 or with a little gap 1 000 000).
I'm aware that this can be done using a JFormattedTextField together with NumberFormat.
What I don't like in the Formatter approach is that it actually modifies the text by inserting characters. I'd rather have a special renderer/decorator which customizes the look only.
(An advantage of this would also be that the formatting would apply already while typing text, not only after committing)
Can this be done? By overriding one of the paint methods of JTextField? Which one? Or by using a different Swing text component?