For example,
JRadioButton age1, age2, age3, age4;
ButtonGroup ageButton;
Then invoke the javax.swing.ButtonGroup constructor, as follows:
ageButton = new ButtonGroup();
The individual buttons are created using the javax.swing.JRadioButton constructor, for example
age1 = new JRadioButton(''age under 20");
The individual buttons are then added to the radio button group using the
javax.swing.Button-Group.add method, as follows:
ageButton.add(age1);
No comments:
Post a Comment