Setting button mnemonic key events without having to use ALT
问题 Is there a way to set a button key event in Java so that Alt does not have to be pressed. For example, when this is used setMnemonic(KeyEvent.VK_DELETE) it is required for Alt + Delete to be pressed in the application. How can I get around this? Thanks. 回答1: I would take a look at the key bindings tutorial. You can specify any KeyStroke to perform any Action . 回答2: Create a KeyListener, or extend a KeyAdapter. Like this: private class MnemonicWorkaround extends KeyAdapter{ @Override public