Reputation: 2678
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
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