Upload
ginger-norton
View
212
Download
0
Embed Size (px)
Citation preview
RADIO BUTTONS AND CHECK BOXES
By: Stag and Fish; Party Animals
Radio Buttons
Radio buttons are a way of letting users choose only one option of a list
Uses of Radio Buttons
Uses: Surveys Multiple choice questions terms of service
How to create Radio Buttons
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
Check boxes are a way to allow users to select multiple options from a list
Uses of Checkboxes
Uses: Surveys with many applicable choices Select all that apply Choosing items from a list
How to create Checkboxes
Check boxes are created using JCheckBox items with unique names
public class Checkboxes extends JPanelimplements 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);
Sources
Java Docs