How can I format the content of a text field while the user is typing. Specifically, I want to add thousand separators to numbers.
(What to do in case of invalid/non-numeric input? Ideally, the formatting would simply not be applied. But it would also be an acceptable solution to me to prevent invalid input in the first place - if there is a good way to do that!)
I've searched for a solution of this problem for a long time and tried lots of examples, but none of the existing answers (e.g. Question about JTextField and text format with numbers?) are satisfying.
Thanks a lot!