uic.widgets
Class HSVSelector

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byuic.widgets.HSVSelector
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public class HSVSelector
extends JComponent

This widget provides a color selection panel. This panel draws a HSV (aka HSB) style color selection area and allows the user to click for selection. A 'propertyChange' event is fired when the user made a selection. You can subscribe to all propertychange signals and use the HSVSelector.SIGNALNAME to filter only the relevant ones. Notice that all colors provided in the API are in default Color objects, which tend to be RGB.

Since:
1.1
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String SIGNALNAME
           
 
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
HSVSelector()
           
HSVSelector(Color input)
           
 
Method Summary
 Color getColor()
           
 int[] getHSVColor()
          Fetch the current color in HSV color space.
 Dimension getMaximumSize()
           
 Dimension getMinimumSize()
           
 Dimension getPreferredSize()
           
 boolean getUpdateOnlyOnChange()
          Specifies wheather we sent propertyChange events on each and every change, or only on select.
 void handleMouseEvent(MouseEvent e, boolean lastEvent)
           
protected  void hsColorClicked(float x, float y)
           
 boolean isFocusable()
           
 boolean isFocusTraversable()
           
 void paint(Graphics g)
           
 void setColor(Color input)
           
 void setHSVColor(int h, int s, int v)
           
 void setUpdateOnlyOnChange(boolean updateOnlyOnChange)
          Specifies wheather we sent propertyChange events on each and every change, or only on select.
protected  void valueSelected(float y)
           
 
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, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, 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, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.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, 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, isFocusOwner, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIGNALNAME

public static final String SIGNALNAME
See Also:
Constant Field Values
Constructor Detail

HSVSelector

public HSVSelector()

HSVSelector

public HSVSelector(Color input)
Method Detail

getMinimumSize

public Dimension getMinimumSize()

getMaximumSize

public Dimension getMaximumSize()

getPreferredSize

public Dimension getPreferredSize()

setColor

public void setColor(Color input)

paint

public void paint(Graphics g)

hsColorClicked

protected void hsColorClicked(float x,
                              float y)

valueSelected

protected void valueSelected(float y)

getColor

public Color getColor()

getHSVColor

public int[] getHSVColor()
Fetch the current color in HSV color space. The ranges apprear vary between implementations so here are ours; Hue ranges from 0 to 320
Saturation ranges from 0 to 255
Value (or Brightness) ranges from 0 to 255

Returns:
an array of the hsv ints (3 values)

setHSVColor

public void setHSVColor(int h,
                        int s,
                        int v)

handleMouseEvent

public void handleMouseEvent(MouseEvent e,
                             boolean lastEvent)

getUpdateOnlyOnChange

public boolean getUpdateOnlyOnChange()
Specifies wheather we sent propertyChange events on each and every change, or only on select.

Returns:
updateOnlyOnChange as boolean.

setUpdateOnlyOnChange

public void setUpdateOnlyOnChange(boolean updateOnlyOnChange)
Specifies wheather we sent propertyChange events on each and every change, or only on select.

Parameters:
updateOnlyOnChange - the value to set.

isFocusable

public boolean isFocusable()

isFocusTraversable

public boolean isFocusTraversable()


Copyright © 2002,2003 Thomas Zander Available under the Free Apache licence