Java Robot Keypress Command Key

2020-03-01 04:23发布

问题:

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.

回答1:

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