If we consider i have a ButtonGroup
component, which have two JRadioButton
like this :
JRadioButton bButton = new JRadioButton("Boy");
JRadioButton gButton = new JRadioButton("Girl");
ButtonGroup group = new ButtonGroup();
bButton.setSelected(true);
group.add(bButton);
group.add(gButton);
How can I get all the JRadioButton
components from the ButtonGroup
ordered by the default order so I can set the first JRadioButton
Selected?
Finally i found the solution, i think there are a way to return
Enumeration<AbstractButton>
, so use it to return all theJRadioButton
of thisButtonGroup