ButtonGroup: setSelected(ButtonModel m, boolean b) : ButtonGroup « javax.swing « Java by API






ButtonGroup: setSelected(ButtonModel m, boolean b)

  
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

1.ButtonGroup: add(AbstractButton b)
2.ButtonGroup: getSelection()