ChoiceTest
Prerequisites
In this exercise, you will write an applet that creates and displays a Choice component.
Perform the following tasks:
Create an applet called ChoiceTest. In the init method, create and add an object called MyChoice that you will create later.
Create a class called MyChoice that extends Choice. In its constructor, add three items: "Chocolate", "Vanilla", and "Strawberry".
Define the method action in MyChoice so that when the user selects an item, it is printed to System.out.
The task numbers above are linked to the
step-by-step help page. Also available
is a complete solution which meets
these requirements.
Related Exercises
|