开发者

Global accelerator in java swing

I have made accelerators in my java gui by using setAccelerator(), and they work unless something with the s开发者_如何学Goame key binding is in focus. Is there a way to enable them globally so the action is triggered no matter what if the window has focus?

jmi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK))


Take a look at Global Event Dispatching. You should be able to use a KeyEventDispatcher to intercept any key event to do your custom processing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜