简体   繁体   English

JFrame在图标化时监听KeyEvent

[英]JFrame listening for KeyEvent while Iconified

How can I keep my JFrame listening for KeyEvent while its state is iconified? 如何在图标状态被标识时让JFrame监听KeyEvent

For example after pressing F1 to start the program (an auto clicker) and iconify the frame (remember that because of the click the focus on the frame is lost!) :) 例如,在按F1键启动程序(自动点击器)并图标化框架之后(请记住,由于单击,框架上的焦点丢失了!):)

If you're trying to create a key-logger program with Java, don't. 如果您尝试使用Java创建按键记录程序,请不要。 It's not a good tool for creating this since it by design is isolated from the OS, in other words it's "OS-agnostic". 它不是创建此工具的好工具,因为它是从设计上与操作系统隔离的,换言之,它是“与操作系统无关的”。 You will need to use a different tool for your allegedly nefarious plans such as C or C++ since these languages allow you to get closer to the "metal". 您将需要为您所称的邪恶计划(例如C或C ++)使用其他工具,因为这些语言使您可以更接近“金属”。

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

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