Menus

Java provides a rich set of menu-related classes for creating and interacting with pull-down menus. The MenuComponent class is the superclass of all menu-related classes. It is important to note that it extends the Object class instead of Component, and it defines an AWT class hierarchy separate from the hierarchy descending from Component. It provides several methods, the most useful of which are the following:

  • getFont() and setFont()— Get and set the font associated with the menu component.

  • getName() and setName()— Get and set the name of the menu component.

  • getParent()— Returns the parent container of the menu component.

The MenuComponent class has two direct subclasses, MenuBar and MenuItem, which provide most of the methods for creating ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.