By: Stag and Fish; Party Animals
Radio buttons are a way of letting users choose only one option of a list
Uses: Surveys Multiple choice questions terms of service
They are created by implementing `JRadioButton` and grouping the buttons into a `ButtonGroup` public class Demo extends JPanel implements ActionListener { //Create a set of private reusable variables private String button1 = “Choice 1"; public Demo () { super(new BorderLayout()); //I have no idea what this does //Create Choice 1 JRadioButton button1 = new JRadioButton(Choice 1);
Check boxes are a way to allow users to select multiple options from a list
Uses: Surveys with many applicable choices Select all that apply Choosing items from a list
Check boxes are created using JCheckBox items with unique names public class Checkboxes extends JPanel implements ItemListener { private JCheckBox b1; public Checkboxes() { super(new BorderLayout()); //This is a mystery //Create the check boxes. b1 = new JCheckBox("Do not uncheck!"); b1.setSelected( true);
Java Docs