JobTitleList
Prerequisites
In this Exercise, you will create a compound component
containing a Label and a List pop-up menu. This will be used in the main RegistrationForm
as a means of specifying a person's job title.
Other examples of creating your own components can be found
in the LabeledChoiceTest
and RadioButtons Exercises.
Perform the following tasks:
Create an Applet to hold one
instance of JobTitleList so you can test the component.
Create class JobTitleList as a subclass of FormElement.
In the class JobTitleList, create a centered Label and a List below. Set the List so that multiple selections are not allowed.
Implement the method isEmpty of FormElement to return true if the List has a selected element.
Implement the method getContents of FormElement. It should return the Label and the currently selected element of the List.
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
|