Decimal Point

Anybody knows how to set some functions for the decimal point. i mean i can input point in a certain transaction? thanks..

this is the code im using:

char ch = evt.getKeyChar();

try{

Integer.parseInt(ch+"");

}catch (NumberFormatException ex){

evt.consume();

}

Message was edited by:

_onmosh_

[584 byte] By [_onmosh_a] at [2007-11-27 4:48:14]
# 1

> Anybody knows how to set some functions for the

> decimal point. i mean i can input point in a certain

> transaction? thanks..

Can you run that by one more time? Perhaps with a little more detail? I'm having trouble understanding exactly what it is you want.

/Pete

petes1234a at 2007-7-12 10:01:05 > top of Java-index,Desktop,Core GUI APIs...
# 2

Why dont you use Strings instead of a single char? You could get the whole number instead of the number divided by parts...

you could also use Double to get "floating points" numbers.

but in this way, since you are getting char by char you could use the decimal point to divide the number. When you get to the point, you start counting: Before the point (left), you multiply the number by 1, 10, 100 etc, after you multiply by 0.1, 0.01, etc.

hope I could help

Leo77a at 2007-7-12 10:01:05 > top of Java-index,Desktop,Core GUI APIs...
# 3
oh..sorry for that....it means is there another way the user can input a point(.) in jTextField because the code is only for number..right? thanks.like you input a 2.1.
_onmosh_a at 2007-7-12 10:01:05 > top of Java-index,Desktop,Core GUI APIs...