Search code examples
javaswingradio-buttonradio-groupjradiobutton

multiple radio group give short cut key in keyboard for each radio button for each group java swing


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


Solution

  • See AbstractButton.setMnemonic(char).

    My bad..

    This method is now obsolete, please use setMnemonic(int) to set the mnemonic for a button.