954,554 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

char to keycode

Hey,

Is there a way to get the keycode from a char? I tried using KeyEvent.getKeyCode() but the KeyEvent class didn't have a constructor so it was freaking out. I've been searching for 2+ hours already and nothing. My goal is to have a char, convert it to keycode, and then use the keycode in the robot class's KeyPress([keycode]) method.

caswimmer2011
Light Poster
27 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

This link
http://stackoverflow.com/questions/1248510/convert-string-to-keyevents
includes a brute force switch to do the conversions. Not pretty, but probably your quickest & easiest option.

JamesCherrill
Posting Genius
Moderator
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
 

Oh, wow, ya, not the prettiest code out there but i'll try it. Thanks!

caswimmer2011
Light Poster
27 posts since Oct 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: