The Menu Classes

The AWT contains four main classes to handle menus:

To use menus in your application you need to add instances of all three classes, one MenuBar with one or more Menus, each with several MenuItems.

The java.awt.MenuComponent class is the ultimate superclass of all these classes. MenuComponent extends java.lang.Object. Thus menus, menu bars, and menu items are not components and cannot be added to containers in the usual fashion.


Both MenuBar and MenuItem extend MenuComponent. Menu extends MenuItem. (This sounds a little strange, but if you think about it a menu is an item in a menu bar.) Furthermore, MenuBar implements the java.awt.MenuContainer interface.

Previous | Next | Top | Cafe au Lait

Copyright 1997, 2002, 2003 Elliotte Rusty Harold
Last Modified March 4, 2003