Choice

Choice objects are pop-up menus. The visible label of the Choice object is the currently selected entry of the Choice. Items are added to the Choice object via the Choice addItem method.



Corresponding source code:

import java.applet.*;
import java.awt.*;
public class ChoiceWidget extends Applet {
    public void init()
    {
        Choice rgb = new Choice();
        rgb.addItem("Red");
        rgb.addItem("Green");
        rgb.addItem("Blue");
        add(rgb);
    }
}

Method(s) of note:

Related Magercise(s):