Class ColorWheelPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
javax.swing.colorchooser.AbstractColorChooserPanel
org.pushingpixels.radiance.theming.internal.contrib.randelshofer.quaqua.colorchooser.RadianceColorChooserPanel
org.pushingpixels.radiance.theming.internal.contrib.xoetrope.editor.color.ColorWheelPanel
- All Implemented Interfaces:
ActionListener, MouseListener, MouseMotionListener, MouseWheelListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener
public class ColorWheelPanel
extends RadianceColorChooserPanel
implements ActionListener, MouseListener, MouseMotionListener, MouseWheelListener, ChangeListener
A color wheel showing a Red, Yellow, Blue color model traditionally used by
graphic artists. $Revision: 2254 $
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class(package private) classA class that wraps the image of the color wheel and draws markers for the selected color schemeNested classes/interfaces inherited from class JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate intstatic final intstatic final intprivate static double[]private doubleprotected JTextFieldprotected JLabelprotected Ellipse2Dprotected JTextFieldprivate doubleprotected JSliderprivate booleanprivate ArrayList<ChangeListener> protected ModelColorprivate intstatic final intstatic final intprivate booleanprotected JCheckBoxprivate booleanstatic final intprotected JPanelprivate Stringprotected Fontprivate doubleprivate booleanprotected JTextFieldprotected ColorWheelPanel.ColorWheelprotected Ellipse2Dprivate static ResourceBundlestatic final intstatic final intprotected Ellipse2Dprivate GeneralPath[]protected BufferedImageprotected JButtonprivate doubleprivate Colorprivate GeneralPathprivate doubleprotected JTextFieldprivate doubleprotected JSliderprivate Colorprotected ModelColor[]private GeneralPathprivate booleanstatic final intprivate Colorprotected JCheckBoxprivate float[]Fields inherited from class AbstractColorChooserPanel
TRANSPARENCY_ENABLED_PROPERTYFields inherited from class JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRespond to action events for the edit fieldsvoidAdd a listener for changes in the selected colorprotected voidintGet the adjust color wheel flag.private intintGet the selected colors brightnessGet the chooser colorgetColor()Get the selected colorgetHiDpiAwareIcon(int size, ContainerColorTokens tokens) intgetHue()Get the selected colors hueprivate static StringbooleanGet the adjust rollover color flag.intGet the selected colors saturationgetSystemColor(String temp) Get the named system colorvoidinstallChooserPanel(JColorChooser enclosingChooser) voidInvoked when the mouse button has been clicked (pressed and released) on a component.voidInvoked when the mouse exits a component.voidInvoked when the mouse enters a component.voidInvoked when the mouse exits a component.voidInvoked when the mouse exits a component.voidInvoked when a mouse button has been pressed on a component.voidInvoked when a mouse button has been released on a component.voidMove the sliders in rsponse to the mouse wheel(package private) booleanChange the hue to match the angle identified by the point (in the inner circle).voidRemove a change listenerprivate voidReset the displayed color to the color specified by the edit fieldsvoidReset the brightness and saturation multipliers for the ColorWheel.voidsetAdjustWheel(int state) Set the adjust color wheel flag.private voidSet the value of the brightness edit to match the current colorvoidvoidsetColorScheme(int scheme) Set the Itten color scheme to usevoidsetDisplayScheme(boolean disp) Set the display of the color scheme markers.private voidsetHue()Set the value of the hue edit to match the current colorvoidsetHue(int h) Set the selected huestatic voidsetLabelBundle(ResourceBundle labelBundle) voidsetRollover(boolean state) Set the adjust rollover color flag.private voidSet the value of the saturation edit to match the current colorvoidsetSelectedColors(ModelColor[] clrs) Set the reference to the selected colours for the colour schemeprivate booleanShould the color wheel's colors be adjustedprivate voidShow a popup menu with the list of system colorsvoidInvoked when the target of the listener has changed its state.voidbooleanHas the user selected the use decimal rgb checkbox?booleanHas the user selected the use web safe colors checkbox?Methods inherited from class RadianceColorChooserPanel
getLargeDisplayIcon, getSmallDisplayIconMethods inherited from class AbstractColorChooserPanel
getColorFromModel, getColorSelectionModel, getDisplayedMnemonicIndex, getMnemonic, isColorTransparencySelectionEnabled, paint, setColorTransparencySelectionEnabled, uninstallChooserPanelMethods inherited from class JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
MONOCHROMATIC_SCHEME
public static final int MONOCHROMATIC_SCHEME- See Also:
-
CONTRASTING_SCHEME
public static final int CONTRASTING_SCHEME- See Also:
-
SOFT_CONTRAST_SCHEME
public static final int SOFT_CONTRAST_SCHEME- See Also:
-
DOUBLE_CONTRAST_SCHEME
public static final int DOUBLE_CONTRAST_SCHEME- See Also:
-
ANALOGIC_SCHEME
public static final int ANALOGIC_SCHEME- See Also:
-
CTRL_ADJUST
public static final int CTRL_ADJUST- See Also:
-
ALWAYS_ADJUST
public static final int ALWAYS_ADJUST- See Also:
-
NEVER_ADJUST
public static final int NEVER_ADJUST- See Also:
-
hueEdit
-
satEdit
-
brightEdit
-
baseColorEdit
-
pickerImage
-
imagePicker
-
fixedPanel
-
resetBtn
-
brightnessSlider
-
saturationSlider
-
baseColorLabel
-
innerCircle
-
outerCircle
-
borderCircle
-
useWebColors
-
decimalRGB
-
fontSmall
-
chooserColor
-
selectedIttenColours
-
values
private float[] values -
h
private double h -
s
private double s -
b
private double b -
colorScheme
private int colorScheme -
busy
private boolean busy -
displayScheme
private boolean displayScheme -
hasChooser
private boolean hasChooser -
changeListeners
-
arcDelta
private static double[] arcDelta -
ringThickness
private double ringThickness -
paths
-
labelBundle
-
rolloverPath
-
selectedPath
-
showRollovers
private boolean showRollovers -
rolloverColor
-
selectedColor
-
systemColor
-
fontFamily
-
adjustWheel
private int adjustWheel -
adjustRollover
private boolean adjustRollover -
ctrlKeyDown
private boolean ctrlKeyDown -
saturationMultipler
private double saturationMultipler -
brightnessMultipler
private double brightnessMultipler
-
-
Constructor Details
-
ColorWheelPanel
public ColorWheelPanel()Creates a new instance of ColorWheelPanel
-
-
Method Details
-
setSelectedColors
Set the reference to the selected colours for the colour scheme- Parameters:
clrs- the colors
-
addChangeListener
Add a listener for changes in the selected color- Parameters:
l- the change listener to add
-
removeChangeListener
Remove a change listener- Parameters:
l- the change listener to remove
-
useDecimalRGB
public boolean useDecimalRGB()Has the user selected the use decimal rgb checkbox?- Returns:
- true if decimal rgb values are to be shown
-
useWebColors
public boolean useWebColors()Has the user selected the use web safe colors checkbox?- Returns:
- true if only web safe colors are to be shown
-
setDisplayScheme
public void setDisplayScheme(boolean disp) Set the display of the color scheme markers.- Parameters:
disp- true to display the color scheme markers.
-
getHue
public int getHue()Get the selected colors hue- Returns:
- the selected hue in the range 0-255
-
setHue
public void setHue(int h) Set the selected hue- Parameters:
h- the selected hue in the range 0-255
-
getSaturation
public int getSaturation()Get the selected colors saturation- Returns:
- the selected saturation in the range 0-255
-
getBrightness
public int getBrightness()Get the selected colors brightness- Returns:
- the selected brightness in the range 0-255
-
setColorScheme
public void setColorScheme(int scheme) Set the Itten color scheme to use- Parameters:
scheme-- -1 for no scheme display
- 0 for a monchromatic color scheme: MONOCHROMATIC_SCHEME
- 1 for a contrasting color scheme: CONTRASTING_SCHEME
- 2 for a soft-contrasting color scheme: SOFT_CONTRAST_SCHEME
- 3 for a double contrasting color scheme: DOUBLE_CONTRAST_SCHEME
- 4 for a analogical color scheme: ANALOGIC_SCHEME
-
moveHue
Change the hue to match the angle identified by the point (in the inner circle).- Parameters:
pt- the point within the inner circle
-
getAngle
-
setColor
-
getColor
-
getChooserColour
-
setHue
private void setHue()Set the value of the hue edit to match the current color -
setSaturation
private void setSaturation()Set the value of the saturation edit to match the current color -
setBrightness
private void setBrightness()Set the value of the brightness edit to match the current color -
actionPerformed
Respond to action events for the edit fields- Specified by:
actionPerformedin interfaceActionListener
-
resetColor
private void resetColor()Reset the displayed color to the color specified by the edit fields -
mouseClicked
Invoked when the mouse button has been clicked (pressed and released) on a component.- Specified by:
mouseClickedin interfaceMouseListener
-
mousePressed
Invoked when a mouse button has been pressed on a component.- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
Invoked when a mouse button has been released on a component.- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseEntered
Invoked when the mouse enters a component.- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
Invoked when the mouse exits a component.- Specified by:
mouseExitedin interfaceMouseListener
-
mouseMoved
Invoked when the mouse exits a component.- Specified by:
mouseMovedin interfaceMouseMotionListener
-
mouseWheelMoved
Move the sliders in rsponse to the mouse wheel- Specified by:
mouseWheelMovedin interfaceMouseWheelListener
-
mouseDragged
Invoked when the mouse exits a component.- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
stateChanged
Invoked when the target of the listener has changed its state.- Specified by:
stateChangedin interfaceChangeListener- Parameters:
e- a ChangeEvent object
-
buildChooser
protected void buildChooser()- Specified by:
buildChooserin classAbstractColorChooserPanel
-
getDisplayName
- Specified by:
getDisplayNamein classAbstractColorChooserPanel
-
getHiDpiAwareIcon
- Specified by:
getHiDpiAwareIconin classRadianceColorChooserPanel
-
getPreferredSize
- Overrides:
getPreferredSizein classJComponent
-
updateChooser
public void updateChooser()- Specified by:
updateChooserin classAbstractColorChooserPanel
-
installChooserPanel
- Overrides:
installChooserPanelin classAbstractColorChooserPanel
-
setLabelBundle
-
getLabel
-
showSystemColorList
Show a popup menu with the list of system colors- Parameters:
p- the location to display the popup
-
getSystemColor
-
shouldAdjustWheel
private boolean shouldAdjustWheel()Should the color wheel's colors be adjusted- Returns:
- true if the colors should change to match the brightness and saturation
-
getAdjustWheel
public int getAdjustWheel()Get the adjust color wheel flag.- Returns:
- the adjustment mode
-
setAdjustWheel
public void setAdjustWheel(int state) Set the adjust color wheel flag.- Parameters:
state- the color wheel's new adjustment mode ( CTRL_ADJUST | ALWAYS_ADJUST | NEVER_ADJUST );
-
getRollover
public boolean getRollover()Get the adjust rollover color flag.- Returns:
- the adjustment mode
-
setRollover
public void setRollover(boolean state) Set the adjust rollover color flag.- Parameters:
state- the rollover's new adjustment mode ( true | false );
-
resetColorWheel
public void resetColorWheel()Reset the brightness and saturation multipliers for the ColorWheel.
-