borland Packages Class Hierarchy jbcl.control Package Index
java.lang.Object +----java.awt.Component +----java.awt.Container +----com.sun.java.swing.JComponent +----borland.jbcl.view.BeanPanel +----borland.jbcl.control.BevelPanel +----borland.jbcl.control.ColorChooserPanel
Variables Constructors Properties Methods Event Listeners
Implements AdjustmentListener, ItemListener, KeyListener, ImageObserver, MenuContainer, Serializable, EventListener
The ColorChooserPanel component enables the user to select colors visually or to specify color values numerically. You can add ColorChooserPanel to a custom frame or dialog box to give your users the capability of easy color selection.
If you want to have the user select colors within a dialog box, use the ColorChooser component on the Component Palette. It presents the color chooser panel within a dialog box.
The Standard Colors list, number fields, and scroll bars are all interlocked; changing the setting of any type of control automatically updates the settings of the other types of controls.
To change the selected color in the color panel at runtime, call one of the changeColor() methods. The textToValue() method converts a String to a Color object. The valueToText() method converts a Color object to a String.
You can add a custom color to the Standard Colors list using the CUSTOM_TAG variable.
public static final String CUSTOM_TAG = Res.getString(Res.CustomColorTag)Enables you to add an item to the Standard Colors list.
public ColorChooserPanel()Creates a new color chooser panel with no color selected. Uses GridBagLayout.
public ColorChooserPanel(java.awt.Color value)Creates a new color chooser panel with the specified color selected. Uses GridBagLayout.
Parameters:
public boolean isChanged()Read-only property that keeps track of whether the selected color is different than the color that was initially selected when the dialog was opened.
public Color getColorValue() public void setColorValue(java.awt.Color value)Stores the value of the color. See Color.
public boolean isHsbMode() public void setHsbMode(boolean hsbMode)Stores whether the color chooser dialog is in HSB mode. The property stores boolean true or false. If false, the dialog is in RGB mode. Labels the scrollbars "Hue, Saturation, Brightness" or "Red, Green, Blue", and makes their max value 100 (for HSB mode) or 255 (for RGB mode). Changes the displayed numerical color values between the equivalent HSB and RGB values.
public Dimension getPreferredSize()The preferred size of the color chooser dialog box. The preferred size is used by layout managers to stretch out the scrollbars to a usable size.
public void addNotify()
Overrides: borland.jbcl.view.BeanPanel.addNotify()
protected void changeColor(java.awt.Color value)Changes the selected color to the color specified with the value parameter. changeColor() calculates the new HSB and RGB values, updates the number entry text fields with the new HSB and RGB values. updates the positions of the scroll bar sliders, and changes the background color for the color sample.
Parameters:
protected void changeColor(java.awt.Color value, boolean suppressText, boolean suppressScroll)Calculates the new HSB and RGB values. Updates the number entry text fields with the new HSB and RGB values if requested. Updates the positions of the scroll bar sliders if requested. Changes the background color for the color sample.
Parameters:
protected void colorChanged(java.awt.Color newColor)Causes the changed property to be set to true. This property indicates whether a color different than the initial color has been selected. The initial color is the color that was selected upon opening the color chooser panel.
Parameters:
public static Color textToValue(java.lang.String text, boolean localized)Updates the RGB or HSB values automatically when a standard named color is selected in the Standard Colors list.
Parameters:
public static String valueToText(java.awt.Color c, boolean localized)Updates the Standard Colors list automatically when you change the RGB or HSB values in the Custom Color Settings group box to a combination. For example, if you manually enter Red = 255, Blue = 175, and Green = 175, the Standard Colors list will automatically show Pink as the selected item.
Parameters:
public synchronized void addActionListener(java.awt.event.ActionListener l) public synchronized void removeActionListener(java.awt.event.ActionListener l)
public void addAncestorListener(com.sun.java.swing.event.AncestorListener ) public void removeAncestorListener(com.sun.java.swing.event.AncestorListener )
public synchronized void addComponentListener(java.awt.event.ComponentListener ) public synchronized void removeComponentListener(java.awt.event.ComponentListener )
public synchronized void addContainerListener(java.awt.event.ContainerListener ) public void removeContainerListener(java.awt.event.ContainerListener )
public synchronized void addFocusListener(java.awt.event.FocusListener ) public synchronized void removeFocusListener(java.awt.event.FocusListener )
public synchronized void addKeyListener(java.awt.event.KeyListener ) public synchronized void removeKeyListener(java.awt.event.KeyListener )
public synchronized void addMouseListener(java.awt.event.MouseListener ) public synchronized void removeMouseListener(java.awt.event.MouseListener )
public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener ) public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )
public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener ) public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )
public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener ) public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )