javamacoskeyboardawtrobot

Java Robot Keypress Command Key


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.


Solution

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