| java.sun.com > Guidelines Home Page > Java Look and Feel Design Guidelines > Part II: Fundamental Java Application Design > 6: Behavior |
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 Java look and feel applications, the following common mouse operations are available to users:
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.
The following figure shows the relative placement of mouse buttons 1 and 2 on Macintosh, PC, and UNIX mouse devices.
Figure 67 Mouse Buttons and Their Default AssignmentsThe 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.
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.
Mouse-over feedback is a visual effect that occurs when users move the pointer over an area of an application window without pressing the mouse button.
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.
Users can open contextual menus in two ways:
Click here to view the corresponding code for Figure 68 (also available on the book's companion CD-ROM).
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. |