RadioButtons
Prerequisites
In this Exercise, you will create a compound component
containing a Label and two Checkbox components
grouped together to act as radio buttons. This will be used
in the main RegistrationForm
to allow the user to choose between two different Java courses.
Other examples of creating your own components can be found
in the JobTitleList
and CommentBox Exercises.
Perform the following tasks:
Create an Applet to hold one
instance of RadioButtons so you can test your component.
Create the class RadioButtons as a subclass of FormElement.
In class RadioButtons, create a left-justified Label ("Java for: ") and two Checkbox objects ("C++ Programmers" and "Procedural Programmers") to the right, controlled by a CheckboxGroup.
Implement method getContents of FormElement. It should return the Label and the text of the selected course.
The task numbers above are linked to the
step-by-step help page. Also available
is a complete solution that meets
these requirements.
Required by
Related Exercises
|