Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想为 JMenuItem 添加一个热键。我学会了如何添加看起来像 CTRL+SOME_KEY 的键。但我需要的是一个三重热键。类似于 CTRL+ALT+W。我想为 JMenuItem 添加一个热键。但是我应该如何创建这样的热键?
你能看看这对你有用吗?
menuItem.setAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_W, ActionEvent.ALT_MASK + ActionEvent.CTRL_MASK ));
选择:
menuItem.setAccelerator(KeyStroke.getKeyStroke("control alt W"));