I have radio many radio group in my application and each group has many radio button i want to know how it is possible to assign one key board short cut or a combination of keyboard short cut for each button for example i want to put number 1 in first group first radio button so if i select the first group and press 1 in keyboard automatically first radio button will be selected. I am doing it now by tab, when i tab i select the focus radio button but it is not good when there are so many radio button because it takes time if i tab until the last radio button. How is this possible any suggestion is accepted
Asked
Active
Viewed 392 times
1 Answers
2
See AbstractButton.setMnemonic(char)
.
My bad..
This method is now obsolete, please use
setMnemonic(int)
to set the mnemonic for a button.

Andrew Thompson
- 168,117
- 40
- 217
- 433
-
1Oh, my bad. See edit (which BTW - you should notice includes the same text you referred to, and ***give the replacement method***). – Andrew Thompson Nov 17 '14 at 02:32
-
1 more question i need to put the KeyPress event in the form itself not in the button right? – Brownman Revival Nov 17 '14 at 02:33
-
1A mnemonic added to a button (or menu item) will work. The 'form' has no concept of mnemonics, though it is possible to add a [key binding](https://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) that activates the button, it is easier to just add the mnemonic. – Andrew Thompson Nov 17 '14 at 02:40
-
so when ever i press the specified mnemonic button it will select the assigned radiobutton? thank for the idea – Brownman Revival Nov 17 '14 at 02:41