|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.sygem.swing.colorchooser.AdvancedColorChooser
An improved Color Picker dialog/component.
Whilst the API interface is based on the original JColorChooser that comes with Swing, this color picker has a closer resemblence to the kind of color picker found in commercial painting programs.
Features include:
Title: AdvancedColorChooser
Description: A sophisticated Color Chooser dialog
Copyright: Copyright (c) 2004
Company: SyGem Software
Nested Class Summary |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Field Summary | |
static java.lang.String |
SELECTION_MODEL_PROPERTY
The selection model property name. |
Fields inherited from class javax.swing.JComponent |
TOOL_TIP_TEXT_KEY, 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 | |
AdvancedColorChooser()
Simple no-args constructor. |
|
AdvancedColorChooser(java.awt.Color initialColor)
Creates an AdvancedColorChooser component, with the color set to initialColor . |
|
AdvancedColorChooser(javax.swing.colorchooser.ColorSelectionModel model)
Creates an AdvancedColorChooser component, with the ColorSelectionModel set to model . |
Method Summary | |
static void |
addSwatchData(SwatchData data)
Registers a set of Swatch data that will appear in the Swatches window. |
void |
closeRecentColorsWindow()
Closes the Recent Colors window, if it is open. |
void |
closeSwatchesWindow()
Closes the Swatches window, if it is open. |
static javax.swing.JDialog |
createDialog(java.awt.Component c,
java.lang.String title,
boolean modal,
AdvancedColorChooser chooserPane,
java.awt.event.ActionListener okListener,
java.awt.event.ActionListener cancelListener)
Creates and returns a new dialog containing the specified AdvancedColorChooser pane along with "OK", "Cancel", and "Reset"
buttons. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this AdvancedColorChooser. |
java.awt.Color |
getColor()
Gets the current color value from the color chooser. |
CustomColorDataSource |
getDataSource()
Returns the currently registered data source used for storing/retrieving custom color data. |
javax.swing.colorchooser.ColorSelectionModel |
getSelectionModel()
Returns the data model that handles color selections. |
static java.util.Enumeration |
getSwatchData()
Returns an enumeration containing all of the currently registered SwatchData objects. |
static java.awt.Window |
getWindow()
Returns the Window used for holding the color chooser component. |
boolean |
isUseWebColors()
Returns TRUE if the color chooser is limited to web-safe colors. |
static void |
registerCustomColorDataSource(CustomColorDataSource source)
Registers a data source for storing and retrieving custom color indformation. |
static void |
removeSwatchData(java.lang.String title)
Removes a set of Swatch data, based on the title of the Swatch set. |
static void |
removeSwatchData(SwatchData data)
Removes a set of Swatch data from the Swatches window. |
void |
setColor(java.awt.Color c)
Sets the color of this color chooser to the specified color. |
void |
setColor(int c)
Sets the current color of the color chooser to the specified color. |
void |
setColor(int r,
int g,
int b)
Sets the current color of the color chooser to the specified RGB color. |
void |
setDataSource(CustomColorDataSource dataSource)
Sets the data source used for storing/retrieving custom color data. |
void |
setSelectionModel(javax.swing.colorchooser.ColorSelectionModel newModel)
Sets the model containing the selected color. |
void |
setUseWebColors(boolean useWebColors)
Determines whether or not the color chooser is to be limited to web-safe colors. |
void |
setWindow(java.awt.Window window)
Sets the Window used for displaying the color chooser component. |
static java.awt.Color |
showDialog(java.awt.Component component,
java.lang.String title,
java.awt.Color initialColor)
Shows a modal color-chooser dialog and blocks until the dialog is hidden. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String SELECTION_MODEL_PROPERTY
Constructor Detail |
public AdvancedColorChooser() throws java.awt.HeadlessException
Color.white
java.awt.HeadlessException
public AdvancedColorChooser(java.awt.Color initialColor) throws java.awt.HeadlessException
Creates an AdvancedColorChooser component, with the color set to initialColor
.
NOTE: Unless you call setWindow()
, the Swatches and Recent Colors
panels will be unavailable.
initialColor
- The initial color for this color chooser
java.awt.HeadlessException
public AdvancedColorChooser(javax.swing.colorchooser.ColorSelectionModel model) throws java.awt.HeadlessException
Creates an AdvancedColorChooser component, with the ColorSelectionModel set to model
.
NOTE: Unless you call setWindow()
, the Swatches and Recent Colors
panels will be unavailable.
model
- The ColorSelectionModel for this color chooser
java.awt.HeadlessException
Method Detail |
public static void addSwatchData(SwatchData data)
static
so you can call it before using showDialog
.
data
- The SwatchData to be addedshowDialog(java.awt.Component, java.lang.String, java.awt.Color)
public void closeRecentColorsWindow()
public void closeSwatchesWindow()
public static javax.swing.JDialog createDialog(java.awt.Component c, java.lang.String title, boolean modal, AdvancedColorChooser chooserPane, java.awt.event.ActionListener okListener, java.awt.event.ActionListener cancelListener) throws java.awt.HeadlessException
AdvancedColorChooser
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.
c
- the parent component for the dialogtitle
- the title for the dialogmodal
- a boolean. When true, the remainder of the program
is inactive until the dialog is closed.chooserPane
- the AdvancedColorChooser to be placed inside the dialogokListener
- the ActionListener invoked when "OK" is pressedcancelListener
- the ActionListener invoked when "Cancel" is pressed
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true.GraphicsEnvironment.isHeadless()
public javax.accessibility.AccessibleContext getAccessibleContext()
getAccessibleContext
in interface javax.accessibility.Accessible
public java.awt.Color getColor()
public CustomColorDataSource getDataSource()
null
if none)public javax.swing.colorchooser.ColorSelectionModel getSelectionModel()
ColorSelectionModel
objectpublic static java.util.Enumeration getSwatchData()
public static java.awt.Window getWindow()
null
if not setpublic boolean isUseWebColors()
public static void registerCustomColorDataSource(CustomColorDataSource source)
Registers a data source for storing and retrieving custom color indformation.
NOTE: This static method should be used instead of setDataSource
is you
are using the showDialog
method.
source
- CustomColorDataSourceshowDialog(java.awt.Component, java.lang.String, java.awt.Color)
public static void removeSwatchData(java.lang.String title)
title
- The name of the Swatch data to removepublic static void removeSwatchData(SwatchData data)
data
- The SwatchData to be removedpublic void setColor(java.awt.Color c)
ColorSelectionModel
will fire a ChangeEvent
c
- The new Color for this color chooserpublic void setColor(int c)
c
- an integer value that sets the current color in the chooser
where the low-order 8 bits specify the Blue value,
the next 8 bits specify the Green value, and the 8 bits
above that specify the Red value.public void setColor(int r, int g, int b)
r
- an int specifying the amount of Redg
- an int specifying the amount of Greenb
- an int specifying the amount of Blue
java.lang.IllegalArgumentException
- if r,g,b values are out of rangeColor
public void setDataSource(CustomColorDataSource dataSource)
dataSource
- The CustomColorDataSource to usepublic void setSelectionModel(javax.swing.colorchooser.ColorSelectionModel newModel)
newModel
- The new ColorSelectionModel
objectpublic void setUseWebColors(boolean useWebColors)
useWebColors
- True if the color chooser should be limited to web-safe colors.public void setWindow(java.awt.Window window)
window
- The Window used for holding the color chooserpublic static java.awt.Color showDialog(java.awt.Component component, java.lang.String title, java.awt.Color initialColor) throws java.awt.HeadlessException
null
.
component
- the parent Component
for the dialogtitle
- the String containing the dialog's titleinitialColor
- the initial Color set when the color-chooser is shown
null
if the user opted out
java.awt.HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true.GraphicsEnvironment.isHeadless()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |