So i have two JFormattedTextFields, and later in the code two parseInts. On the JFormattedTextFields, I have a NumberFormat. The only issue I have with my code is when you try to enter a number above 999, the system prints out an error. I looked at it and found it was because of the "," (comma) that NumberFormat automatically does. Is there any way around this?
EDIT: Code will be provided on request.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
JFormattedTextField has method getValue() that returns the value according to the format. This will definitely return a Number, but it may be a Double or Long. Regardless, you can call its intValue() method.
Thanks. You have cleaned up the comma problem but a new one has arisen. Could I make a post to have people help clean up my code? I'm not sure what I should have in my code anymore, because I think I can get rid of a lot. I just want to make sure it's allowed here. If my code was "cleaned up", I would be able to better asses the issue.
Thank you very much,
subject: Serious issue: NumberFormat String Parse int problem