The ability to create instances of JColorChooser panes
directly (within any container). PropertyChange listeners
can be added to detect when the current "color" property changes.
- See Also:
- addPropertyChangeListener
, JColorSwatch
-
COLOR_PROPERTY
- The color property name.
-
JColorChooser()
- Creates a color-chooser pane with an initial color of white.
-
JColorChooser(Color)
- Creates a color-chooser pane with the specified initial color.
-
createDialog(Component, String, boolean, JColorChooser, ActionListener, ActionListener)
- Creates and returns a new dialog containing the specified
ColorChooser pane along with "OK", "Cancel", and "Reset" buttons.
-
getColor()
- Gets the current color set in the color chooser.
-
getIntColor()
- Gets the current color set in the color chooser.
-
setColor(Color)
- Sets the current color of the color chooser to the
specified color.
-
setColor(int)
- Sets the current color of the color chooser to the
specified color.
-
setColor(int, int, int)
- Sets the current color of the color chooser to the
specified RGB color.
-
showDialog(Component, String, Color)
- Shows a modal color-chooser dialog and blocks until the
dialog is hidden.
COLOR_PROPERTY
public static final String COLOR_PROPERTY
- The color property name.
JColorChooser
public JColorChooser()
- Creates a color-chooser pane with an initial color of white.
JColorChooser
public JColorChooser(Color initialColor)
- Creates a color-chooser pane with the specified initial color.
- Parameters:
- initialColor - the initial color set in the chooser
showDialog
public static Color showDialog(Component component,
String title,
Color initialColor)
- Shows a modal color-chooser dialog and blocks until the
dialog is hidden. If the user presses the "OK" button, then
this method hides/disposes the dialog and returns the selected color.
If the user presses the "Cancel" button or closes the dialog without
pressing "OK", then this method hides/disposes the dialog and returns
null.
- Parameters:
- c - the parent component for the dialog
- title - the title for the dialog
- initialColor - the initial color set when the color-chooser is shown
createDialog
public static JDialog createDialog(Component c,
String title,
boolean modal,
JColorChooser chooserPane,
ActionListener okListener,
ActionListener cancelListener)
- Creates and returns a new dialog containing the specified
ColorChooser pane along with "OK", "Cancel", and "Reset" buttons.
If the "OK" or "Cancel" buttons are pressed, the dialog is
automatically hidden (but not disposed). If the "Reset"
button is pressed, the color-chooser's color will be reset to the
color which was set the last time show() was invoked on the dialog
and the dialog will remain showing.
- Parameters:
- c - c the parent component for the dialog
- title - the title for the dialog
- modal - whether or not the dialog is modal
- chooserPane - the color-chooser to be placed inside the dialog
- okListener - the ActionListener invoked when "OK" is pressed
- cancelListener - the ActionListener invoked when "Cancel" is pressed
setColor
public void setColor(int r,
int g,
int b)
- Sets the current color of the color chooser to the
specified RGB color.
setColor
public void setColor(Color c)
- Sets the current color of the color chooser to the
specified color.
- Parameters:
- c - the color to be set in the chooser
setColor
public void setColor(int c)
- Sets the current color of the color chooser to the
specified color.
getColor
public Color getColor()
- Gets the current color set in the color chooser.
getIntColor
public int getIntColor()
- Gets the current color set in the color chooser.
All Packages Class Hierarchy This Package Previous Next Index