Tom Kelliher, CS 116
Sept. 25, 2000
Section 3.4, Lab 3 handout.
Component
class, Label
, TextComponent
class.
Lab 3.
The active widgets:
Button
.
Checkbox
. Checkboxgroups
Choice
.
List
.
Example:
Checkbox cb1 = new Checkbox(); Checkbox cb2 = new Checkbox(); CheckboxGroup cbGroup = new CheckboxGroup; // ... cb1.setCheckboxGroup(cbGroup); cb2.setCheckboxGroup(cbGroup);
Example:
Choice flavors = new Choice(); String selectedItem; // ... selectedItem = flavors.getSelectedItem();
Example:
// Three rows, single-selection mode. List myList = List(3, false);
ActiveWidgets.java
. Predict both the appearance of the
applet and its behavior when you interact with it. Test your prediction be
running the applet. The update button will repaint the applet for
you.
TextField
object.
Checkbox
es into a CheckboxGroup
and
observe the group's behavior. Something ``weird'' happens. What? For how
long?
List
with a single-selection
List
.
List
with a Choice
.