The MenuBar, Menu and MenuItem components in combination provide dynamic drop down menus.
The base class is MenuItem, from which Menu and MenuBar are derived. All are in fact derived from Button.
To create a drop down menu, you create a MenuBar object, add Menu and MenuItem objects to it and then add the MenuBar to the container component. Each MenuItem can have an action command string associated with it. Any registered ActionListener will be informed when the user selects a menu item.
MenuBar provides some neat tricks itself. It can be positioned anywhere on the screen, even over other components. It can float down the page so that it is always visible. It can also be made to display vertically down the screen.
|