import java.applet.*;
import java.awt.*;

public class SampleChoice extends java.applet.Applet {

    public void init() {

        // Create choice widget with three entries:
        Choice c = new Choice();
        c.addItem ("Choice1");
        c.addItem ("Choice2");
        c.addItem ("Choice3");
        add(c);
    }

    public boolean action(Event e, Object o) {
        if (e.target instanceof Choice) {

	    // Find out what was selected:
            Choice c     = (Choice)e.target;
            int    index = c.getSelectedIndex();
            String s     = c.getSelectedItem();

	    // Announce what was selected:
            System.out.println(index);
            showStatus(s);

            return true;
        }
        return false;
    }
}
