I have a JFormattedTextField that I want to accept digits in a 5 digit range. The following code works correctly:
myNumberBox = new JFormattedTextField(NumberFormat.getIntegerInstance());
However, when I enter “12345” into the field and switch focus, the comma is inserted because of my locale, creating the text “12,345”. How can I prevent commas from being added to my contribution? Even better is it possible to delete them even if the user inserts commas?
source share