somebody can help me...

Recommended Answers

with a key listener, for instance. you add a key listener that checks the input given, if it's not a number or a ., have it consume the event.

Jump to Post

In addition to the above, be sure to check input again before sending the actual input data. There are users who, when they can't type what they want, will copy-paste their garbage input (with the mouse obviously, how could they ever press two keys at once, that's just madness). Then …

Jump to Post

All 5 Replies

this is only a school assignment,,, but i cant find a way how to solve it.

with a key listener, for instance. you add a key listener that checks the input given, if it's not a number or a ., have it consume the event.

In addition to the above, be sure to check input again before sending the actual input data. There are users who, when they can't type what they want, will copy-paste their garbage input (with the mouse obviously, how could they ever press two keys at once, that's just madness). Then when they don't get a result they'll call you in the middle of the night (because that's when "you guys" work right) telling you to come fix their mouse, because the "mouse inputs" are not getting results.

<heavy breathing>

Are you going to allow more than one . input?
How about backspace and left right keys?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.