how to handle multiple key press in numeric keys

I have used the code from eta . Code is somethg like tis

lastKeyPress = System.currentTimeMillis();

.

..

.

protected void keyPressed(int keyCode){

boolean keyRepeated = false;

if(System.currentTimeMillis() - lastKeyPress < 1000 &&

lastKey == keyCode) {

keyRepeated = true;

lastKey = keyCode;

}

lastKeyPress = System.currentTimeMillis();

switch(keyCode) {

case KEY_NUM0 :

case KEY_NUM1 :

case KEY_NUM2 :

case KEY_NUM3 :

case KEY_NUM4 :

case KEY_NUM5 :

case KEY_NUM6 :

case KEY_NUM7 :

case KEY_NUM8 :

case KEY_NUM9 :

case KEY_POUND :

System.out.println(keyCode);

System.out.println(keyRepeated + "Repeat");

But the 'keyRepeated ' always returning false. It doesnt satisfies the 'if' condition. So i m unable to differentiate btween 'a' ,'b' and 'c'. Pls any one take me to the correct solution

[981 byte] By [Pravin_axe.Chockya] at [2007-11-27 11:33:17]
# 1

it worked for me!!!!

I don't know if you changed something or not.

but it must work.

do you tested it in debug mode. may be for break points system time will not halt.

etaa at 2007-7-29 16:50:25 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

eta

some how i made it to work. but i was unable to control the cursor position. ie when i press numeric button 2 thrice to display 'c' it displays all 'abc' . Its same for all the keys

I have used

string.insert(cursorposition, char)

.

How to get only that 'c'

Pravin_axe.Chockya at 2007-7-29 16:50:25 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 3

Its working well. Eta tnx a lot.

Pravin_axe.Chockya at 2007-7-29 16:50:25 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 4

ok

etaa at 2007-7-29 16:50:25 > top of Java-index,Java Mobility Forums,Java ME Technologies...