| Java >
Guidelines Home Page > Java Look and Feel Design Guidelines >
Part II: Fundamental Java Application Design >
Users interact with the computer by means of the mouse, the keyboard, and the screen. (Throughout this book, "mouse" refers to any pointing device, including standard mouse devices, trackballs, track pads, and so forth.) Such interaction constitutes the "feel" portion of the Java look and feel.
This chapter describes mouse operations, pointers, and drag-and-drop operations. It discusses keyboard operations, including the use of keyboard focus, keyboard shortcuts, and mnemonics in Java look and feel applications. It also offers guidance on how to provide feedback regarding application progress or status.
In your design, assume a two-button mouse. Use mouse button 1 (usually the left button) for selection, activation of components, dragging, and the display of drop-down menus. Use mouse button 2 (usually the right button) to display contextual menus. Do not use the middle mouse button; it is not available on most target platforms.
Provide keyboard equivalents for all mouse operations, including multiple selections.
Be aware that Macintosh systems usually have a one-button mouse, other personal computers and network computers usually have a two-button mouse, and UNIX systems usually have a three-button mouse. Macintosh users can simulate mouse button 2 by holding down the Control key while mousing.Figure 67 Mouse Buttons and Their Default Assignments
The pointer can assume a variety of shapes. For instance, in a text-editing application, the pointer might assume an I-beam shape (called a "text pointer" in the Java 2 platform) to indicate where the insertion point will be if the user presses the mouse button. The insertion point is the location where typed text or a dragged or pasted selection will appear. When the pointer moves out of the editor pane, its appearance changes in accordance with the new component the pointer rests over.
The Java look and feel defines a set of pointer types that map to the corresponding native platform pointers; therefore, the appearance of pointers can vary from platform to platform, as shown in the following table. When no corresponding pointer exists in the native platform toolkit, the pointer is supplied by the JFC.
|Pointer||Macintosh||MIcrosoft Windows||CDE||Usage in Java Look and Feel Applications|
|Default||Pointing or selecting|
|Crosshair||Interacting with graphic objects|
|Hand||Panning objects by direct manipulation|
|Text||Selecting or inserting text|
|Wait||Indicating that an operation is in progress and the user cannot do other tasks|
|N Resize||Adjusting the upper (northern) border of an object|
|S Resize||Adjusting the lower (southern) border of an object|
|E Resize||Adjusting the right (eastern) border of an object|
|W Resize||Adjusting the left (western) border of an object|
|NW Resize||Adjusting the upper-left (northwest) corner of an object|
|NE Resize||Adjusting the upper-right (northeast) corner of an object|
|SE Resize||Adjusting the lower-right (southeast) corner of an object|
|SW Resize||Adjusting the lower-left (southwest) corner of an object|
In addition to the shapes in Table 6, a pointer graphic can be defined as an image and created using
Toolkit.createCustomCursor if you are using the Java 2 platform.
In the Java look and feel, mouse-over feedback can be used to show borders on toolbar buttons when the pointer moves over them. A slightly different effect is used to display tool tips. For details, see Toolbars and Tool Tips.
In the JFC, the selection of objects with the mouse is similar to the standard practice for other graphical user interfaces. Users select an object by clicking it. Clicking an unselected object also deselects any previous selection.
Follow the general JFC-provided rules for text selection:
Follow the general JFC-provided rules for selection in selectable lists and tables:
It can be difficult for users to find and access desired features given all the commands in the menus and submenus of a complex application. Contextual menus (sometimes called "pop-up menus") enable you to make functions easily accessible by associating them with appropriate objects.
Click here to view the corresponding code for Figure 68 (also available on the book's companion CD-ROM).Figure 68 Contextual Menu for a Text Selection
Because users often have difficulty knowing whether contextual menus are available and what is in them, ensure that the items in your contextual menu also appear in the menu bar or toolbar of the primary windows in your application.
Users on the Microsoft Windows and UNIX platforms display a contextual menu by clicking or pressing mouse button 2. Macintosh users hold down the Control key while clicking.
|Java Look and Feel Design Guidelines, second edition.
Copyright 2001. Sun Microsystems, Inc. All Rights Reserved.