Java - How to apply a keyboard shortcut of 3 keys for a JButton?
问题 Currently i am using "Ctrl + Space" shortcut to fire a JButton event in my Java code like this : this.getRootPane().registerKeyboardAction( addStudentButtonActionListener, KeyStroke.getKeyStroke( KeyEvent.VK_SPACE, KeyEvent.CTRL_MASK ), JComponent.WHEN_IN_FOCUSED_WINDOW ); But i want to assign a shortcut of "Shift + Ctrl + Space" for this event instead. How can i do that ? 回答1: Then use the following key stroke: KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, KeyEvent.SHIFT_MASK | KeyEvent.CTRL