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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.