|
How to handle keys from the keypad of your mobile device |
|
|
This Java tips describes the method of handling keyEvents on mobile device.
This tip may help game developers in developing 'key' features of their
applications.
public void paint(Graphics g) {
g.drawString(msg,0,25,g.TOP|g.LEFT);
g.drawString("press any KEY",0,80,g.TOP|g.LEFT);
}
//Handling keyEvents
protected void keyPressed(int keyCode) {
msg= "keyCode:" + keyCode;
switch(keyCode) {
case '1':
msg+=" hello"
break;
case '2':
msg+=" from"
break;
case '3':
msg+=" jjkk"
break;
}
repaint();
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.