Reputation: 28905
Given an integer which comes from KeyEvent.VK_[value]
, such as KeyEvent.VK_SPACE
or KeyEVENT.VK_F3
, I'd like to convert it to the String of the key.
For example
keyIntToString(KeyEvent.VK_SPACE)
would return "Space"
How can I do this?
I've tried
KeyEvent.getKeyText(KeyEvent.VK_SPACE);
In the terminal, if I print that, I get "Space". In Eclipse if I print that, I get "?". In a JLabel if I display that, I get a square.
What I really want is to get it into a JLabel. How do I do this?
Upvotes: 0
Views: 1419