Java Robot Keypress Command Key

Abaab picture Abaab · Mar 14, 2013 · Viewed 12.1k times · Source

What is the VK_[key] code for the command key on a mac, if one exists? I am trying to get a Robot (java Robot) to press the command key. I am using the command keyPress(), and I need to know the integer keycode for the command key on a mac.

Answer

FThompson picture FThompson · Mar 14, 2013

KeyEvent.VK_META, with key code 157, is Java's virtual key that maps to the the Mac command key.