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.

Recommended Answers

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.

Jump to Post

All 2 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.