Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java converting keycode to string or char

I want to turn keyevent keycode value into a string or a char value. Either one would do.

For example, when I press 'SPACE', which 'lets say' has a keycode 20, and I want to convert that value to a char or a string. Is there any standard way of doing so, or I have to write a bunch of 'if' statements for every key on the keyboard?

like image 860
user2098268 Avatar asked Apr 13 '13 19:04

user2098268


Video Answer


1 Answers

Cast it to Char.

Char c=(Char)keycode;
like image 119
bluevoid Avatar answered Oct 03 '22 03:10

bluevoid