How to set a shortcut key for JRadioButton without modifiers
I'm working in a project where I need to add a key shortcut for each JRadioButton , while looking on another similar question and as I'm using some other custom Action s I decided to use the method setAction on each of my JRadioButton s, however it requires me to press ALT + 1 - ALT + 5 to "trigger" the actionPerformed method of my CustomAction class. How can I modify this class in order to just press 1 - 5 and get the same behaviour? This is the code I made that demonstrates this issue: import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction;