您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)


Extend Index

Extend Page # 1

AWT menu classes

AWT uses three main classes to manage and display menus, as shown in the figure below. There is also a 'PopupMenu' class. A PopupMenu is like a Menu, but usually appears when the user clicks the mouse and disappears after an item has been selected.

The structure can be described as follows:

A MenuItem is the element that the user selects to carry out a specific action

A Menu is comprised of a number of MenuItem objects

A MenuBar is comprised of a number of Menu objects

A MenuBar can be placed at the top of a window (e.g., an applet).

The procedure for constructing a complete menu in Java will be described later.

Note: In Java, applets can't have menu bars. A menu bar can be added to a Frame window (described later), so stand-alone applications can have menus. Applets can have a 'pop-up' menu, that is, a menu which becomes visible when the user clicks the mouse in the applet.

Back to top

basicline.gif (170 bytes)