I would like to have a set of JRadioButtonMenuItem's and JRadioButtons
referring to the same group. Selecting the "red" radio button in the
menu will also set the "red" radio button on the panel. How do I go
about referring two or more radio buttons to the same group element.
All I can figure is having two groups, two listeners, and each listener
copy its changed group model to the other group.
Is there a more elegant solution?
Vova Reznik - 16 Mar 2006 16:26 GMT
> I would like to have a set of JRadioButtonMenuItem's and JRadioButtons
> referring to the same group. Selecting the "red" radio button in the
[quoted text clipped - 3 lines]
> copy its changed group model to the other group.
> Is there a more elegant solution?
You may share ButtonModel:
redRadioButtonMenu.setModel(redRadioButton.getModel());
and add to a button group only one button from pair menu:button