Hi all
My first post here, and I'm relatively new to Java programming, although I've been an Oracle developer for over a decade now.
On to my problem.
I need to create a field on a form that only allows the user to input whole numbers (integers).
I've implemented this as follows:
This works in the sense that it only allows integer values in the field, and along with other code, does just about everything I need.
The only problem I have is changing the number entirely. The numberFormatter will not let me delete the last character in the field.
E.g.
If the initial value is 600,000, and I delete the 6, the field shows 0. I cannot delete this zero so that the field is empty, which I need to do.
If I delete the zeros one after the other, I am left with a 6 that I can't delete.
This is not good, because to update the field from 600,000 to 12 (for example), I have to do the following:
1. Delete all the zeros, leaving the 6.
2. Enter 12, meaning the value in the field is now 612, or 126 depending on how the initial value was modified by the user.
3. Delete the 6.
I've looked at the NumberFormatter and IntegerFormatter classes and documentation but can't see anything that allows the field to contain blank values.
Is there an option to allow an IntegerFormatter to have a blank field?
If not, can anyone suggest another way of doing this?
Thanks
Alex