Search code examples
java-mekeyboard-eventslwuit

Is it possible to get the char through the key code in Lwuit?


I'm trying to find some way to get the char or its key through an ActionEvent's KeyEvent. I don't even know in which class I could find such a method.

Actually I have some old code containing hundred of lines of code, where we could map keycodes to characters, but it's a real pain, since different devices and languages mean special cases. I really want to avoid that.

Regards.


Solution

  • Just cast the keyCode integer to a char to get the actual character value. For a keypad you will always get numbers and for a qwerty device you will get letters.