开发者

Keys shortcuts, Java

开发者 https://www.devze.com 2023-02-28 22:40 出处:网络
I want to add a hotkey to JMenuItem. I learned how to add key that look like CTRL+SOME_KEY. But what I need, is a triple hotkey. Somthing like CTRL+ALT+W. I w开发者_如何转开发ant to add a hotkey to JM

I want to add a hotkey to JMenuItem. I learned how to add key that look like CTRL+SOME_KEY. But what I need, is a triple hotkey. Somthing like CTRL+ALT+W. I w开发者_如何转开发ant to add a hotkey to JMenuItem. But how should I create such hotkey?


Can you see if this will work for you?

menuItem.setAccelerator(KeyStroke.getKeyStroke(
        KeyEvent.VK_W, ActionEvent.ALT_MASK + ActionEvent.CTRL_MASK ));


Alternative:

menuItem.setAccelerator(KeyStroke.getKeyStroke("control alt W"));
0

精彩评论

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

关注公众号