jbcl.control Package
java.lang.Object +----com.borland.jbcl.control.ColorChooser
Variables Constructors Properties Methods Event Listeners
Implements WindowListener, Serializable, EventListener
ColorChooser
is a dialog box that enables the user to select a color either by specifying color settings by RGB or HSB numerical values or by visually selecting a color.
To display the dialog box at runtime, call the show()
method or set the visible
property to true. When the user selects a color, the selection is stored in the value
property.
The dialog box has two buttons, OK and Cancel. Which button the user chooses to put away the dialog box is stored as the value of the result
property. The title
property contains the text that appears on the title bar of the dialog box's frame.
You can make the ColorChooser
component appear at design time:
ColorChooser
component on the UI Designer or on the Component Tree.
frame
property to this in the Component Inspector.
visible
property to true.
protected transient ActionMulticaster actionMulticaster
public static final int CANCEL = ButtonDialog.CANCELOne of the possible values of the
result
property. If the value of result
is CANCEL, the user clicked the Cancel button in the dialog box.
protected ColorChooserDialog dialog
protected Component focus
protected Frame frame
public static final int OK = ButtonDialog.OKOne of the possible values of the
result
property. If the value of result
is OK, the user clicked the OK button in the dialog box.
protected int result
protected String title
protected Color value
public ColorChooser()Creates a new color chooser dialog box without a frame or any title bar text. No initial color value is selected.
public ColorChooser(Frame frame)Creates a new color chooser dialog, specifying the frame as the parent, with no title bar text. No initial color value is selected.
Parameters:
frame
public ColorChooser(Frame frame, String title)Creates a new color chooser dialog using the specified frame and title bar text. No initial color value is selected.
Parameters:
frame
title
public ColorChooser(Frame frame, String title, Color value)Creates a new color chooser dialog. If a frame is specified, the dialog is created by calling the constructor of
ColorChooserDialog
.
Parameters:
frame
title
value
public Frame getFrame() public void setFrame(Frame frame)The parent frame of the color chooser dialog box. If you add a
ColorChooser
to a frame at design time, specify the frame
property value as this.
public int getResult() public void setResult(int i)Determines which button the user clicked in the dialog box, Cancel or OK. The possible values are the
CANCEL
and OK
variables.
public String getTitle() public void setTitle(String title)Determines the title text of the color chooser dialog box, shown in the title bar.
public Color getValue() public void setValue(Color value)Determines the actual color value. When the user selects a color using the dialog box and chooses the OK button, the value of the
value
property changes.
public boolean isVisible() public void setVisible(boolean visible)The
visible
property determines whether the ColorChooser
dialog box is visible or hidden. If visible
is true, the dialog box is visible; otherwise it is hidden. If visible
is set to true, a new ColorChooserDialog
is created, the result
property is set, the dialog box registers itself as a window listener, and if the frame is showing on the screen, the frame receives the focus, and the dialog box appears.
public void show()Sets the
visible
property to true, which usually results in the dialog box appearing.
public void addActionListener(ActionListener l) public void removeActionListener(ActionListener l)