Java TM Look and Feel Design Guidelines: Advanced Topics > Part I: General Topics > 4: Behavior > Selecting Multiple Objects   Previous Next Contents/Index/Search


 

Selecting Multiple Objects

Users sometimes want to use a single command to perform the same action on multiple objects--that is, on more than one object at a time. To provide this capability in your application, you first need to provide multiple selection, the ability to select more than one object at a time.

Follow these rules when enabling users to select multiple objects:

  • When multiple objects are selected, each command that can apply only to a single object is unavailable--for example, a command that renames an object.
  • Clicking an object (with the primary mouse button) deselects any existing selection and selects the object. An alternative is to press the spacebar while keyboard focus is on an object. (For information on mouse operations, see Chapter 6 of Java Look and Feel Design Guidelines , 2d ed.)
  • Shift-clicking an object extends the selection from the most recently selected object to the object under the pointer. An alternative is pressing Shift-spacebar while keyboard focus is on the object.
  • Control-clicking an object toggles its selection without affecting the selection of any other objects. This operation can result in selecting more than one range of objects. An alternative is pressing Control-spacebar while keyboard focus is on an object.
  • Dragging--moving the mouse while pressing a mouse button--selects the objects inside the bounding box . (Dragging works this way only in a 2-dimensional selection area, such as an icon pane .)

For more information about multiple selection in lists and in tables, see "Selection Models and Editing Models for Tables" on page 72 . In addition, see Chapter 12 and Appendix A of Java Look and Feel Design Guidelines , 2d ed.

 Enable users to select multiple objects in a component if any of the component's commands can apply to more than one object at time.

 If users can select multiple objects with the mouse, enable users to select multiple objects with the keyboard as well.

 When users use the mouse to select multiple objects, select each object whose center is within the bounding box.


Java Look and Feel Design Guidelines: Advanced Topics.
Copyright 2001. Sun Microsystems, Inc. All Rights Reserved.
Previous Next Contents/Index/Search
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
JavaOne Banner
Java 8 banner (182)