O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Menu Classes

Figure 17-1 shows the relationships between the AWT's menu classes.

Figure 17-1. AWT Menu Classes Diagram

We will be concerned with four classes when dealing with menus: MenuBar, Menu, MenuItem, and PopupMenu. The first thing to note from the class diagram is that each of these classes extends MenuComponent; a MenuComponent is simply something that can be displayed in a menu. Second, notice that Menu and Menubar both implement MenuContainer, meaning they may both contain instances of MenuComponent. Finally, note that Menu extends MenuItem; this enables the creation of cascading menus, as we shall soon discover.

It is worth repeating ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required