Michael Dunn wrote:you have 3 textFields, with keyListeners on each
before you type anything, their getText() would return an empty string ("")
you type a character into one of the textFields, and your code tries to parse
all 3 textFields at the same time, so when it tries to parse "", it will error
you could test for the source in your KeyListener code, but do you really
want the listener firing on each keyStroke?
A button ("Calculate") might be better suited for the user to press when all
textfields have input data.
thanks you so much !
I understand the problem now and I fixed in my way
here the soultion if anyone want
all I did was that I added 0 to the string !
if the user entered number for example 5
it will be 05 and it's the same as 5 !
but if he entered a char g
it will be 0g --> throw exception !
I'm really thankful for all the great ppl here
thank you so much ! this problem have been bother me for almost a 3 weeks !