borland Packages  Class Hierarchy  jbcl.control Package  Index 

ColorChooser component

java.lang.Object
   +----borland.jbcl.control.ColorChooser

About the ColorChooser component

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:

  1. Drop the ColorChooser component on the UI Designer or on the Component Tree.
  2. Set whatever properties you want in the Component Inspector.
  3. Set the frame property to this in the Component Inspector.
  4. Set the visible property to true.

ColorChooser variables

Variables implemented in this class

ColorChooser constructors

ColorChooser properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

ColorChooser methods

Methods implemented in this class

Methods implemented in java.lang.Object

ColorChooser event listeners


ColorChooser variables

actionMulticaster

  protected transient ActionMulticaster actionMulticaster

CANCEL

  public static final int CANCEL = ButtonDialog.CANCEL
One 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.

dialog

  protected ColorChooserDialog dialog

focus

  protected Component focus

frame

  protected Frame frame

OK

  public static final int OK = ButtonDialog.OK
One 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.

result

  protected int result

title

  protected String title

value

  protected Color value

ColorChooser constructors

ColorChooser()

  public ColorChooser()
Creates a new color chooser dialog box without a frame or any title bar text. No initial color value is selected.

ColorChooser(java.awt.Frame)

  public ColorChooser(java.awt.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
The parent frame of the color chooser dialog box.

ColorChooser(java.awt.Frame, java.lang.String)

  public ColorChooser(java.awt.Frame frame, java.lang.String title)
Creates a new color chooser dialog using the specified frame and title bar text. No initial color value is selected.

Parameters:

frame
The parent frame of the color chooser dialog box.
title
The title text of the color chooser dialog box, usually shown in the title bar.

ColorChooser(java.awt.Frame, java.lang.String, java.awt.Color)

  public ColorChooser(java.awt.Frame frame, java.lang.String title, java.awt.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
The parent frame of the color chooser dialog box.
title
The title text of the color chooser dialog box, usually shown in the title bar.
value
The active color value.


ColorChooser properties

frame

 public Frame getFrame()
 public void setFrame(java.awt.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.

result

 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.

title

 public String getTitle()
 public void setTitle(java.lang.String title)
Determines the title text of the color chooser dialog box, shown in the title bar.

value

 public Color getValue()
 public void setValue(java.awt.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.

visible

 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.


ColorChooser methods

show()

  public void show()
Sets the visible property to true, which usually results in the dialog box appearing.

ColorChooser event listeners

This component is a source for the following event sets. For information on the standard AWT event sets, see Standard Java events.

action

 public void addActionListener(java.awt.event.ActionListener l)
 public void removeActionListener(java.awt.event.ActionListener l)