Oracle JEWT API Reference
Release 4.2.24.0.0
B12199-01

oracle.bali.ewt.chooser.color
Class ColorChooserPane

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--oracle.bali.ewt.painter.PaintContextComponent
                          |
                          +--oracle.bali.ewt.LWComponent
                                |
                                +--oracle.bali.ewt.chooser.color.ColorChooserPane
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ColorChooserPane
extends oracle.bali.ewt.LWComponent
implements javax.accessibility.Accessible

This class implements a Color Chooser Pane. The component contains an area that allows the users to pick a color with the mouse, as well as optional areas to pick a color by RGB, HSL, HSB, and HTML hex.

Clients can also add their own ColorEditor components to the ColorChooserPane using addColorEditor(). These components will be added below all other existing components.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static int BUTTON_CANCEL
          Constant indicating that the cancel button was pressed.
static int BUTTON_OK
          Constant indicating that the OK button was pressed.
static int COLOR_PICKER_CMY
          The constant used to determine if the CMY color picker is displayed.
static int COLOR_PICKER_CMYK
          Deprecated. CMY is now supported instead of CMYK, thus the constant COLOR_PICKER_CMY is more appropriately named.
static int COLOR_PICKER_HSB
          The constant used to determine if the HSB color picker is displayed.
static int COLOR_PICKER_HSL
          The constant used to determine if the HSL color picker is displayed.
static int COLOR_PICKER_HTMLHEX
          The constant used to determine if the HTML Hex color picker is displayed.
static int COLOR_PICKER_RGB
          The constant used to determine if the RGB color picker is displayed.
static java.lang.String PROPERTY_COLOR
          The PropertyName to listen for when the user changes the color.
static java.lang.String PROPERTY_COLOR_NAME
          The PropertyName to listen for when the user changes the selected color's name.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ColorChooserPane()
          Create a ColorChooserPane with the selected color set to black and the RGB, HSB, and HTML HEX color pickers displayed.
ColorChooserPane(java.awt.Color selectedColor, int pickerMask)
          Create a ColorChooserPane with the given selected color set to black and the given bit mask of color pickers to displayed.
 
Method Summary
 void addCustomColorEditor(ColorEditor editor)
          Add a custom ColorEditor to the ColorChooserPane.
 void addNotify()
          Override to set strings.
 void dispose()
          Free any memory associated with this ColorChooserPane.
 javax.accessibility.AccessibleContext getAccessibleContext()
          Get the AccessibleContext associated with this JComponent
 java.awt.Color getColor()
          Returns the color that is currently displayed, or null if there is no color.
 java.lang.String getColorName()
          Get the name of the currently selected color.
 int getColorPickerMask()
          Get the OR mask representing the currently visible set of color picker components.
 ColorEditor[] getCustomColorEditors()
          Get a list of all custom ColorEditors that have been added to the ColorChooserPane.
 java.awt.Color getOriginalColor()
          Get the "original" color of the ColorChooserPane.
 boolean isColorNameVisible()
          Get if the color name text field is visible.
 void removeCustomColorEditor(ColorEditor editor)
          Remove a custom ColorEditor to the ColorChooserPane.
 void setColor(java.awt.Color c)
          Sets the color displayed in the pane.
 void setColorName(java.lang.String name)
          Set the name of the currently selected color.
 void setColorNameVisible(boolean visible)
          Set if the color name text field is visible.
 void setColorPickerMask(int colorPickerMask)
          Set the OR mask that represents the set of visible color picker.
 void setEnabled(boolean enabled)
          Override to pass onto children.
 void setLocale(java.util.Locale newLocale)
          Override to set strings when locale changes.
 void setOriginalColor(java.awt.Color color)
          Set the "original" color of the ColorChooserPane.
static int showDialog(java.awt.Component parent, ColorChooserPane pane)
          Show the given ColorChooserPane in a modal, non resiable Dialog with the default title, centered over the given parent component.
static int showDialog(java.awt.Component parent, ColorChooserPane pane, java.lang.String dialogTitle, boolean resizable)
          Show the given ColorChooserPane in a modal Dialog with the given resizablity, with the given title, centered over the given parent component.
 
Methods inherited from class oracle.bali.ewt.LWComponent
clipToParents, freezeRepaints, getActualAlignment, getActualReadingDirection, getAlignment, getBorderInsets, getDocumentSize, getFill, getPageBounds, getPrintPaintContext, isFocusTraversable, paintChildren, paintComponent, paintImmediateInterior, paintImmediateInterior, paintImmediately, paintOverChildren, printPage, processEvent, processEventImpl, repaint, repaintInterior, repaintInterior, setAlignment, setFill, unfreezeRepaints, updateUI
 
Methods inherited from class oracle.bali.ewt.painter.PaintContextComponent
getBorderContext, getPaintContext, getPaintData, getPaintState, getUIDefaults, setUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROPERTY_COLOR

public static final java.lang.String PROPERTY_COLOR
The PropertyName to listen for when the user changes the color.

PROPERTY_COLOR_NAME

public static final java.lang.String PROPERTY_COLOR_NAME
The PropertyName to listen for when the user changes the selected color's name.

COLOR_PICKER_RGB

public static final int COLOR_PICKER_RGB
The constant used to determine if the RGB color picker is displayed.

COLOR_PICKER_HSB

public static final int COLOR_PICKER_HSB
The constant used to determine if the HSB color picker is displayed.

COLOR_PICKER_HSL

public static final int COLOR_PICKER_HSL
The constant used to determine if the HSL color picker is displayed.

COLOR_PICKER_HTMLHEX

public static final int COLOR_PICKER_HTMLHEX
The constant used to determine if the HTML Hex color picker is displayed.

COLOR_PICKER_CMYK

public static final int COLOR_PICKER_CMYK
Deprecated. CMY is now supported instead of CMYK, thus the constant COLOR_PICKER_CMY is more appropriately named.


COLOR_PICKER_CMY

public static final int COLOR_PICKER_CMY
The constant used to determine if the CMY color picker is displayed.

BUTTON_OK

public static final int BUTTON_OK
Constant indicating that the OK button was pressed.
See Also:
showDialog(java.awt.Component, oracle.bali.ewt.chooser.color.ColorChooserPane)

BUTTON_CANCEL

public static final int BUTTON_CANCEL
Constant indicating that the cancel button was pressed.
See Also:
showDialog(java.awt.Component, oracle.bali.ewt.chooser.color.ColorChooserPane)
Constructor Detail

ColorChooserPane

public ColorChooserPane()
Create a ColorChooserPane with the selected color set to black and the RGB, HSB, and HTML HEX color pickers displayed.

ColorChooserPane

public ColorChooserPane(java.awt.Color selectedColor,
                        int pickerMask)
Create a ColorChooserPane with the given selected color set to black and the given bit mask of color pickers to displayed.
Method Detail

showDialog

public static int showDialog(java.awt.Component parent,
                             ColorChooserPane pane)
Show the given ColorChooserPane in a modal, non resiable Dialog with the default title, centered over the given parent component.
Parameters:
parent - The parent component to center the dialog over.
pane - The ColorChooserPane to show in the dialog
Returns:
Either BUTTON_OK or BUTTON_CANCEL indicating if the user pressed ok or cancel.

showDialog

public static int showDialog(java.awt.Component parent,
                             ColorChooserPane pane,
                             java.lang.String dialogTitle,
                             boolean resizable)
Show the given ColorChooserPane in a modal Dialog with the given resizablity, with the given title, centered over the given parent component.
Parameters:
parent - The parent component to center the dialog over.
pane - The ColorChooserPane to show in the dialog
dialogTitle - The title of the dialog
resizable - True if the dialog containing the ColorChooserPane is resizable
Returns:
Either BUTTON_OK or BUTTON_CANCEL indicating if the user pressed ok or cancel.

setColor

public void setColor(java.awt.Color c)
Sets the color displayed in the pane. If c is null Color.black is used.

getColor

public java.awt.Color getColor()
Returns the color that is currently displayed, or null if there is no color.

setOriginalColor

public void setOriginalColor(java.awt.Color color)
Set the "original" color of the ColorChooserPane. In some cases users are changing a color from one value to another. The originalColor helps users identify what the original color was, If clients specify an originalColor a colored box will be displayed at the top of the chooser with the originalColor. This box will never change color. If the user clicks on this box the selected color will change back to the originalColor.
See Also:
getOriginalColor()

getOriginalColor

public java.awt.Color getOriginalColor()
Get the "original" color of the ColorChooserPane. In some cases users are changing a color from one value to another. The originalColor helps users identify what the original color was, If clients specify an originalColor a colored box will be displayed at the top of the chooser with the originalColor. This box will never change color. If the user clicks on this box the selected color will change back to the originalColor.
See Also:
setOriginalColor(java.awt.Color)

setColorName

public void setColorName(java.lang.String name)
Set the name of the currently selected color.
See Also:
getColorName(), isColorNameVisible()

getColorName

public java.lang.String getColorName()
Get the name of the currently selected color.
See Also:
setColorName(java.lang.String), isColorNameVisible()

setColorNameVisible

public void setColorNameVisible(boolean visible)
Set if the color name text field is visible.
See Also:
getColorName(), isColorNameVisible()

isColorNameVisible

public boolean isColorNameVisible()
Get if the color name text field is visible.
See Also:
getColorName(), setColorNameVisible(boolean)

setColorPickerMask

public void setColorPickerMask(int colorPickerMask)
Set the OR mask that represents the set of visible color picker. This can be any combination of any of the COLOR_PICKER constants.

See Also:
getColorPickerMask()

getColorPickerMask

public int getColorPickerMask()
Get the OR mask representing the currently visible set of color picker components. This can be any combination of any of the COLOR_PICKER constants.
See Also:
setColorPickerMask(int)

addCustomColorEditor

public void addCustomColorEditor(ColorEditor editor)
Add a custom ColorEditor to the ColorChooserPane. This ColorEditor will be displayed at the bottom of the ColorChooserPane.
See Also:
removeCustomColorEditor(oracle.bali.ewt.chooser.color.ColorEditor), getCustomColorEditors()

removeCustomColorEditor

public void removeCustomColorEditor(ColorEditor editor)
Remove a custom ColorEditor to the ColorChooserPane.
See Also:
addCustomColorEditor(oracle.bali.ewt.chooser.color.ColorEditor), getCustomColorEditors()

getCustomColorEditors

public ColorEditor[] getCustomColorEditors()
Get a list of all custom ColorEditors that have been added to the ColorChooserPane.
See Also:
addCustomColorEditor(oracle.bali.ewt.chooser.color.ColorEditor), removeCustomColorEditor(oracle.bali.ewt.chooser.color.ColorEditor)

dispose

public void dispose()
Free any memory associated with this ColorChooserPane. Once dispose() is called the ColorChooserPane will become unusable.

setEnabled

public void setEnabled(boolean enabled)
Override to pass onto children.
Overrides:
setEnabled in class javax.swing.JComponent

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Get the AccessibleContext associated with this JComponent
Specified by:
getAccessibleContext in interface javax.accessibility.Accessible
Overrides:
getAccessibleContext in class javax.swing.JComponent
Returns:
the AccessibleContext of this JComponent

addNotify

public void addNotify()
Override to set strings.
Overrides:
addNotify in class javax.swing.JComponent

setLocale

public void setLocale(java.util.Locale newLocale)
Override to set strings when locale changes.
Overrides:
setLocale in class java.awt.Component

Oracle JEWT 4.2.24

Copyright © [xxxx],2003, Oracle. All Rights Reserved.