Day 11: Building Simple User Interfaces for Applets
NOTES AND CORRECTIONS
- Q: I am currently programming a quiz applet using check
boxes. I have called each check box's setEnabled(false) method
to keep users from answer a question twice, and then I have a Reset
button after the quiz is finished that re-enables all of the boxes.
How can I clear out the answers that were chosen at the same time? I
want the check boxes to appear as if the quiz has never been taken
after Reset is pressed.
A: The setState() method is used -- call setState(true)
to place a check in a box and setState(false) to remove it.
There's more information on all of the methods and variables in Sun's
official documentation for java.awt.Checkbox.