简体   繁体   English

从小程序“转发”按键到JFrame

[英]“Forwarding” keypresses from an applet to a JFrame

I have a JFrame which contains a JApplet. 我有一个包含JApplet的JFrame。 There are shortcut keys that I have configured for the JFrame that work fine when the focus is on some panel of it, but once I click into the applet, none of the shortcut keys work anymore. 当焦点位于JFrame的某个面板上时,我为JFrame配置了一些快捷键,这些快捷键可以正常工作,但是一旦我单击了applet,所有快捷键都无法正常工作。 Is there any way that I can forward these key presses to the JFrame so that the events are still fired? 有什么方法可以将这些按键转发到JFrame,以便事件仍被触发?

I resolved this problem by running applet.setFocusable(false); 我通过运行applet.setFocusable(false);解决了这个问题applet.setFocusable(false); before adding it to the JFrame. 在将其添加到JFrame之前。

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

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