java.awt.Choice
class implements a popup menu with a fixed position. (The java.awt.PopupMenu
class is a popup menu with no fixed position. It pops up when the user clicks and holds the right mouse button.)
Creating a choice menu is a little more complex than creating the other user interface components you've seen. There's an extra step, adding the menu items to the menu. That is the five steps are
Choice
Choice
Choice
Choice
to the layout
ItemListener
to the Choice
public void init() {
Choice ch;
ch = new Choice();
ch.addItem("1");
ch.addItem("2");
ch.addItem("3");
ch.addItem("4");
ch.addItem("5");
add(ch);
}