jwo.utils
Class JWColourRing

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--jwo.utils.JWColourRing
All Implemented Interfaces:
Accessible, EventListener, ImageObserver, MenuContainer, MouseListener, MouseMotionListener, Serializable

public class JWColourRing
extends Canvas
implements MouseListener, MouseMotionListener

Creates a colour ring for displaying HSV colour space.

Version:
1.8.0, 23rd June, 2000
Author:
Jo Wood
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Canvas
Canvas.AccessibleAWTCanvas
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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
JWColourRing(int radius)
          Creates a hue colour ring surrounding a saturation- brightness square.
JWColourRing(int radius, Color colour)
          Creates a hue colour ring surrounding a saturation- brightness square.
 
Method Summary
 Color getColour()
          Reports the currently selected colour.
 Dimension getMinimumSize()
          Determines the minimum size of the bean.
 Dimension getPreferredSize()
          Determines the preferred size of the bean.
 void mouseClicked(MouseEvent mouseEvent)
          Checks for mouse clicks, but does nothing.
 void mouseDragged(MouseEvent mouseEvent)
          Checks for mouse drag and continuously changes selected colour.
 void mouseEntered(MouseEvent mouseEvent)
          Checks for pointer entering event, but does nothing.
 void mouseExited(MouseEvent mouseEvent)
          Checks for pointer exiting event, but does nothing.
 void mouseMoved(MouseEvent mouseEvent)
          Checks for mouse movement, but does nothing.
 void mousePressed(MouseEvent mouseEvent)
          Checks for mouse button press, changes colour selected.
 void mouseReleased(MouseEvent mouseEvent)
          Checks for mouse button release and turns off mouse movement query.
 void paint(Graphics g)
          Paints colour ring onto the canvas.
 void setColour(Color newColour)
          Sets the currently selected colour to a given value.
 void update(Graphics g)
          Overrides the update method to stop the screen from being recleared each time.
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JWColourRing

public JWColourRing(int radius)
Creates a hue colour ring surrounding a saturation- brightness square. Initialises with a default colour.

Parameters:
radius - Radius of colour ring in pixels.

JWColourRing

public JWColourRing(int radius,
                    Color colour)
Creates a hue colour ring surrounding a saturation- brightness square. Initialises with a given colour.

Parameters:
radius - Radius of colour ring in pixels.
Method Detail

getColour

public Color getColour()
Reports the currently selected colour.

Returns:
Currently selected colour.

setColour

public void setColour(Color newColour)
Sets the currently selected colour to a given value.

Parameters:
newColour - New colour to store.

getPreferredSize

public Dimension getPreferredSize()
Determines the preferred size of the bean. This is also the initial and minimum size.

Overrides:
getPreferredSize in class Component
Returns:
Preferred size of the bean.

getMinimumSize

public Dimension getMinimumSize()
Determines the minimum size of the bean.

Overrides:
getMinimumSize in class Component
Returns:
Minimum size of the bean.

update

public void update(Graphics g)
Overrides the update method to stop the screen from being recleared each time.

Overrides:
update in class Canvas
Parameters:
g - Graphics context to paint to.

paint

public void paint(Graphics g)
Paints colour ring onto the canvas. Overrides the paint() method.

Overrides:
paint in class Canvas
Parameters:
g - The graphics context to paint to.

mouseClicked

public void mouseClicked(MouseEvent mouseEvent)
Checks for mouse clicks, but does nothing. Implements interface method.

Specified by:
mouseClicked in interface MouseListener
Parameters:
mouseEvent - Mouse click event.

mousePressed

public void mousePressed(MouseEvent mouseEvent)
Checks for mouse button press, changes colour selected. Implements interface method.

Specified by:
mousePressed in interface MouseListener
Parameters:
mouseEvent - Mouse press event.

mouseReleased

public void mouseReleased(MouseEvent mouseEvent)
Checks for mouse button release and turns off mouse movement query.

Specified by:
mouseReleased in interface MouseListener
Parameters:
mouseEvent - Mouse release event.

mouseMoved

public void mouseMoved(MouseEvent mouseEvent)
Checks for mouse movement, but does nothing.

Specified by:
mouseMoved in interface MouseMotionListener
Parameters:
mouseEvent - Mouse movement event.

mouseEntered

public void mouseEntered(MouseEvent mouseEvent)
Checks for pointer entering event, but does nothing.

Specified by:
mouseEntered in interface MouseListener
Parameters:
mouseEvent - Pointer entering event.

mouseExited

public void mouseExited(MouseEvent mouseEvent)
Checks for pointer exiting event, but does nothing.

Specified by:
mouseExited in interface MouseListener
Parameters:
mouseEvent - Mouse exiting event.

mouseDragged

public void mouseDragged(MouseEvent mouseEvent)
Checks for mouse drag and continuously changes selected colour.

Specified by:
mouseDragged in interface MouseMotionListener
Parameters:
mouseEvent - Mouse press event.