| java.sun.com > Guidelines Home Page > Java Look and Feel Design Guidelines > Part III: The Components of the Java Foundation Classes > 8: Dialog Boxes and Alert Boxes > Color Choosers |
A color chooser provides one or more content panes from which users can select colors and a preview mechanism by which users can view the selected colors in context. You can display a color chooser in a dialog box, as shown in the following figure. The three command buttons (OK, Cancel, and Help) are part of the dialog box, not the color chooser. (A color chooser can also be implemented in a multiple-use dialog box.)
Figure 120 JFC-Supplied Color Chooser
As supplied by the JFC, the color chooser offers users three methods for selecting a color:
In addition, the color chooser offers a preview panel within the dialog box.
If your application requires a different method for choosing colors, you can add a content pane with that feature. You can also remove existing content panes. If you use only one content pane, the tabs disappear. In addition, you can specify your own preview panel or alter the supplied one.
The color
chooser is a panel. The color panel can be inserted in a dialog box
by using the JDialog container. This operation is accomplished with the
static method CreateDialog on the JColorChooser container.
Alternately, this can be done with the ShowDialog method, which creates,
displays, and dismisses the dialog box.
| Java Look and Feel Design Guidelines, second edition.
Copyright 1994-2004 Sun Microsystems, Inc. All Rights Reserved. |