program-o-steve
program-o-steve

Reputation: 2678

getting keytyped from the keycode

I have to send the key code in hexadecimal to a function whose job is to tell which key's code is that. For example key code in java for CONTROL key in hexadecimal form is 0x11. Is there a way i can directly get the key typed ? Otherwise i have to use switch statement. But i don't want to consider it.I think that is not a smart way to do this.

Upvotes: 1

Views: 1208

Answers (1)

Mechanical snail
Mechanical snail

Reputation: 30647

Use java.awt.event.KeyEvent.getKeyText(int keyCode). According to the Javadoc: it

Returns a String describing the keyCode, such as "HOME", "F1" or "A".

Upvotes: 3

Related Questions