LabeledChoice
Prerequisites
In this Exercise, you will create a compound component
containing a Label and a Choice pop-up menu. This will be used
in the main RegistrationForm
example as an input region for the user payment method.
Other examples of creating your own components can be found
in the JobTitleList
and RadioButtons Exercises. Because the LabeledChoice subclasses FormElement,
be sure to complete the FormElement
Exercise before you start on this one.
Perform the following tasks:
Create an Applet to hold one
instance of LabeledChoice so that you can test the component.
Create the class LabeledChoice as a subclass of FormElement.
In the class LabeledChoice, create a left-justified Label and a Choice to the right. Make the Choice
fill the entire remaining width of the Panel.
Implement the method getContents of FormElement. It should return the Label and the contents of the Choice.
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
|