简体   繁体   English

Java Robot 类中 Mac Option 键的 KeyEvent?

[英]KeyEvent for the Mac Option key in Java Robot class?

I was wondering if there was a KeyEvent code for the Mac "Option" key within the java.awt.event.KeyEvent library.我想知道java.awt.event.KeyEvent库中是否有 Mac“Option”键的 KeyEvent 代码。 I'm trying to write a class for executing Mac OS specific shortcuts (ie SHIFT + OPTION + COMMAND + ESC), but I can't find the code for the Option key anywhere.我正在尝试编写一个类来执行 Mac OS 特定的快捷方式(即 SHIFT + OPTION + COMMAND + ESC),但我在任何地方都找不到 Option 键的代码。 Any help is appreciated!任何帮助表示赞赏!

Try logging it to find out it's keyCode and find the key with the same keycode as what you logged.尝试记录它以找出它的 keyCode 并找到与您记录的 keycode 相同的 key。 In case logging doesn't help you out, try using ALT.如果日志记录对您没有帮助,请尝试使用 ALT。

From what I know, for all intents and purposes, Mac's option is usually the equivallent of ALT on Windows, and will probably end up resolving as VK_ALT据我所知,出于所有意图和目的,Mac 的选项通常相当于 Windows 上的ALT ,最终可能会解析为VK_ALT

EDIT: Upon further inspection, it seems that Option uses keycode 58 ( http://macbiblioblog.blogspot.com/2014/12/key-codes-for-function-and-special-keys.html ) and it seems you're out of luck, since the awt.event.KeyEvent doesn't cover that one...编辑:经过进一步检查,似乎 Option 使用键码 58 ( http://macbiblioblog.blogspot.com/2014/12/key-codes-for-function-and-special-keys.html ),看来您是运气不好,因为 awt.event.KeyEvent 没有涵盖那个......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM