List of usage examples for javax.swing JRadioButton JRadioButton
public JRadioButton(String text, Icon icon, boolean selected)
From source file:Main.java
public Main() { JRadioButton radMarriedYes = new JRadioButton("Yes", new ImageIcon("img/icon.gif"), false); JRadioButton radMarriedNo = new JRadioButton("No?", false); JRadioButton radGolfYes = new JRadioButton("Yes?", false); JRadioButton radGolfNo = new JRadioButton("No?", true); ButtonGroup radioGroup1 = new ButtonGroup(); ButtonGroup radioGroup2 = new ButtonGroup(); setLayout(null);//from ww w. j a v a2 s . c o m add(radMarriedYes); add(radMarriedNo); add(radGolfYes); add(radGolfNo); radioGroup1.add(radMarriedYes); radioGroup1.add(radMarriedNo); radioGroup2.add(radGolfYes); radioGroup2.add(radGolfNo); radMarriedYes.setBounds(30, 50, 50, 20); radMarriedNo.setBounds(30, 80, 50, 20); radGolfYes.setBounds(150, 50, 50, 20); radGolfNo.setBounds(150, 80, 50, 20); }