| JavaTM Look and Feel Design Guidelines: Advanced Topics > Part I: General Topics > 3: Menus > Contextual Menus | ![]() |
A contextual menu is a menu displayed when a user presses mouse button 2 while the pointer is over an object or area associated with that menu. Contextual menus are one of two main types of menus--the other type being drop-down menus, which users choose from a menu bar. Figure 33 shows a contextual menu.
Figure 33 Contextual Menu (Displayed Over a Table)
Contextual menus provide quick access to menu items available elsewhere in an application. A contextual menu should include only frequently used menu items; otherwise, it will be hard to use.
Although contextual menus and drop-down menus are alike in most ways, contextual menus differ from drop-down menus in the following ways:
The correct menu items for a contextual menu depend on where the pointer is when a user opens that menu. Table 7 describes the correct types of menu items for contextual menus opened from various pointer positions.
If a user opens a contextual menu for an object that is not selected, that object becomes selected. The new selection cancels any previous selection.
Some objects have a default command, executed if a user double-clicks the object. When displaying the contextual menu for such an object, use bold to display the menu item that activates the default command. For an example, see Figure 33, in which Open is the default command.
The following guidelines help you design contextual menus. These guidelines supplement those in Chapter 9 of Java Look and Feel Design Guidelines, 2d ed.
Provide contextual menus only as conveniences that are redundant with
other controls--typically with items in your application's drop-down menus.
Each item in a contextual menu must be available elsewhere in your
application.
If your application has contextual menus, ensure that it has them for all
its objects.
Include only frequently used menu items in contextual menus.
If the object of a contextual menu has a default command, place that
command at the top of the contextual menu. In addition, display the command
in bold.
In an open contextual menu, dim unavailable menu items that can apply
to the current object. Do not display unavailable menu items that cannot apply
to the current object.
In a contextual menu for a selection, ensure that each menu item that
operates on an object can be applied to each object in the selection. (That is,
ensure that the set of menu items for the selected objects is an intersection, not
a union.)
When designing contextual menus, follow the rules in Table 7.
| Java Look and Feel Design Guidelines: Advanced Topics.
Copyright 2001. Sun Microsystems, Inc. All Rights Reserved. |
![]() |