Selecting a JRadioButton Component in a Button Group
import javax.swing.ButtonGroup;
import javax.swing.ButtonModel;
import javax.swing.JRadioButton;
public class Main {
public static void main(String[] argv) throws Exception {
JRadioButton radioButton = new JRadioButton();
ButtonGroup group = new ButtonGroup();
ButtonModel model = radioButton.getModel();
group.setSelected(model, true);
}
}
Related examples in the same category