简体   繁体   English

Applet未聚焦时的键盘侦听器

[英]Keyboard Listener when Applet Not Focused

I am creating an applet to listen for hotkeys to be pressed, such as F12 or F11 to stop/start the process of the program. 我正在创建一个小程序,以侦听要按下的热键,例如F12或F11,以停止/启动程序的过程。

How do I listen for these hotkeys even when the program isn't the one active on the screen? 即使程序不在屏幕上,我也该如何收听这些热键?

How do I listen for these hotkeys even when the program isn't the one active on the screen? 即使程序不在屏幕上,我也该如何收听这些热键?

You can't. 你不能 Nor should you. 你也不应该 F11 is used in FF (for example) to go to full-screen. F11用于FF(例如)进入全屏模式。

Your problem is that you're using the absolutely worst tool for your need that can be imagined, Java, since it tries to remain as far from the OS as possible. 您的问题是Java正在针对您的需求使用绝对最糟糕的工具,因为Java试图将其尽可能地远离OS。 Instead why not use a better tool, such as AutoIt V3 if for Windows. 相反,为什么不使用更好的工具,如Windows,则使用AutoIt V3。

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

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