Java" Look and Feel Design Guidelines: Menus
In most applications, menus are one of the main ways that users issue commands. To provide maximum usability, menus must be logically ordered and easily accessible.
This chapter helps you design usable menus. It provides guidelines for designing:
Menu elementsmenu titles, menu items, mnemonics, and so on
Common menusmenus found in most applications
Contextual menusmenus whose items affect the object or area under the pointer
To understand this chapter, you should be familiar with the menu-related terms (such as drop-down menu). This chapter is intended only for applications with menus.
Menu Elements
Figure 22 shows menu elements in a typical application.
In Figure 22:
Each menu title consists of exactly one word.
The menu titles fit in a single line in the menu bar.
The command name in each menu item is a single word or a short phrase, such as "Save As."
No menu item has a command name identical to the menu's title. (For example, no item in the File menu is labeled "File.")
All menu titles and menu items use headline capitalization style. (For more information about headline capitalization, see Chapter 4 of Java Look and Feel Design Guidelines, 2d ed.)
Figure 22 Menu Elements
Menu elements in most applications should have these characteristics, each of which promotes usability.
TIP
When a window is at its default size, ensure that the titles of its drop-down menus all fit on a single line in the menu bar, without being truncated.
Ensure that the title of a drop-down menu consists of exactly one word.
In drop-down menus, ensure that the label of each menu item differs from the menu title.
Keyboard Shortcuts and Mnemonics for Menu Items
Keyboard shortcuts and mnemonics are keyboard equivalents to menu items.
A keyboard shortcut is a keystroke combination (usually a modifier key and a character key, like Control-C) that activates a menu item from the keyboard, even if the relevant menu is not currently displayed.
A mnemonic is an underlined alphanumeric character in a menu title or menu item. A mnemonic shows a user which key to press (sometimes in conjunction with the Alt key) to activate a menu item or navigate to it.
An item's mnemonic differs from its keyboard shortcut. Figure 22 on page 31 shows mnemonics and keyboard shortcuts for items in a typical File menu.
Table 5 lists mnemonics for typical menus and menu items. To use the mnemonics in Table 5, users can simultaneously press the Alt key and the character key that corresponds to the underlined letter or numeral. (For more information, see Chapter 6 of Java Look and Feel Design Guidelines, 2d ed.)
Table 5 Common Mnemonics
Menu Title |
Menu Items |
File |
New, New Window, Open, Open in New Window, Open in Current Window, Close, Save, Save As, Page Setup, Print, Preferences, File Properties1, Exit |
Edit |
Undo, Redo, Cut, Copy, Paste, Delete, Find, Find Again, Select All |
Format |
Bold, Italic, Underline, Align Left, Align Center, Align Right |
View |
Large Icons, Small Icons, List, Details, Sort By, Filter, Zoom In, Zoom Out, Refresh |
Help |
Contents, Tutorial, Index, Search, About Application-Name |
Table 6 lists common keyboard shortcuts.
Table 6 Common Keyboard Shortcuts
Sequence |
Equivalent Menu Item |
Ctrl-N |
New (File menu) |
Ctrl-O |
Open (File menu) |
Ctrl-W |
Close (File menu) |
Ctrl-S |
Save (File menu) |
Ctrl-P |
Print (File menu) |
Ctrl-Z |
Undo (Edit menu) |
Ctrl-Y |
Redo (Edit menu) |
Ctrl-X |
Cut (Edit menu) |
Ctrl-C |
Copy (Edit menu) |
Ctrl-V |
Paste (Edit menu) |
Delete |
Delete (Edit menu) |
Ctrl-F |
Find (Edit menu) |
Ctrl-G |
Find Again (Edit menu) |
Ctrl-H |
Replace (Edit menu) |
Ctrl-A |
Select All (Edit menu) |
Ctrl-B |
Bold (Format menu) |
Ctrl-I |
Italic (Format menu) |
Ctrl-U |
Underline (Format menu) |
Ctrl-J |
Justify (Format menu) |
Ctrl-L |
Align Left (Format menu) |
Ctrl-E |
Align Center (Format menu) |
Ctrl-R |
Align Right (Format menu) |
F1 |
Help |
Shift-F1 |
Contextual help |
F10 |
Refresh |
For more information about keyboard shortcuts and mnemonics, see those topics in Chapter 6 of and elsewhere in that book.
TIP
Assign mnemonics to all menu titles and menu items. Use the mnemonics in Table 5 if your application includes any of the menu titles and menu items listed there.
Provide keyboard shortcuts for frequently used menu items. Use the keyboard shortcuts in Table 6, if possible.
Available and Unavailable Items
A menu item is dimmed when its command is unavailable. In Figure 23, the Paste and Paste Special items are unavailable and, therefore, dimmed.
Figure 23 Menu with Unavailable Items
TIP
Dim a menu item if it represents an unavailable command, and users can make that command available without exiting the application. If the command becomes available, undim the menu item. (For more information on available and unavailable menu items, see Chapter 9 of Java Look and Feel Design Guidelines, 2d ed.)
Additional Conventions for Menu Items
Like the conventions described so far in this chapter, the following conventions help users to work with menus.
Separators
You can group menu items by inserting separators between groups. In Figure 23, the Undo and Redo items of the Edit menu are a group, set apart from the menu's other groups by a separator.
Ellipses
An ellipsis (...) at the end of a menu item indicates that an application needs additional user input to execute the item's command. An ellipsis indicates that the application will display a dialog box before executing the command. However, not all menu items that open additional windows should have an ellipsis. For example, the About item in a Help menu should not end in an ellipsis.
TIP
Place an ellipsis (...) at the end of a menu item only if that item opens a dialog box that requests user input for completing an action.
Do not place an ellipsis (...) after a menu item that opens a property window.
Menu Item Graphics
You can place graphics before the leading edge of menu items, as in Figure 22 on page 31.
Provide menu item graphics only if there are corresponding toolbar button graphics in your application. The graphics help users associate the toolbar button with the corresponding menu command. Provide menu item graphics for all the qualified menu items or for none of them.
TIP
The recommended menu graphics are at the following web site: http://developer.java.sun.com/developer/techDocs/hi/repository/