|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gicentre.utils.colour.ColourPicker
public class ColourPicker
Creates a graphical colour picker using Cynthia Brewer's 'ColorBrewer' schemes. ColorBrewer specifications and designs developed by Cynthia Brewer (colorbrewer.org).
Constructor Summary | |
---|---|
ColourPicker(processing.core.PApplet sketch)
Initialises the colour picker with default border size, but does not display it [requires setIsActive(true)]. |
|
ColourPicker(processing.core.PApplet sketch,
int xBorder,
int yBorder)
Initialises the colour picker with the given border sizes, but does not display it (requires setIsActive(true)]. |
Method Summary | |
---|---|
void |
addPickerListener(PickerListener pickerListener)
Adds the given pickerListener to those that will be informed when a colour has been chosen by the colour picker. |
void |
draw()
Draws the colour swatches from which items may be picked. |
boolean |
getIsActive()
Reports whether or not the colour picker is currently active. |
int |
getLastColour()
Reports the last selected colour. |
ColourTable |
getLastColourTable()
Reports the last selected colour table. |
void |
mouseClicked(java.awt.event.MouseEvent e)
Responds to a mouse click in the colour picker, if active, updating the last selected colour and firing an event to all PickerListener s. |
void |
mouseDragged(java.awt.event.MouseEvent e)
Responds to a mouse being dragged over the colour picker, if active, updating the last selected colour. |
void |
mouseEntered(java.awt.event.MouseEvent e)
Would respond to a mouse entering the colour picker, but does nothing in this case. |
void |
mouseExited(java.awt.event.MouseEvent e)
Would respond to a mouse leaving the colour picker, but does nothing in this case. |
void |
mouseMoved(java.awt.event.MouseEvent e)
Would respond to a mouse being moved over the colour picker, but does nothing in this case. |
void |
mousePressed(java.awt.event.MouseEvent e)
Would respond to a mouse being pressed in the colour picker, but does nothing in this case. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Responds to a mouse being released over the colour picker. |
boolean |
removePickerListener(PickerListener pickerListener)
Removes the given pickerListener from those that will be informed when a colour has been chosen by the colour picker. |
void |
setIsActive(boolean isActive)
Determines whether or not the colour picker should be currently active. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ColourPicker(processing.core.PApplet sketch)
sketch
- Sketch that will use the colour picker.public ColourPicker(processing.core.PApplet sketch, int xBorder, int yBorder)
sketch
- Sketch that will use the colour picker.xBorder
- Width in pixels of the border to the left and right of the picker.yBorder
- Height in pixels of the border to the top and bottom of the picker.Method Detail |
---|
public void draw()
draw()
method. If the colour picker is not
active, nothing will be drawn.
public boolean getIsActive()
public void setIsActive(boolean isActive)
isActive
- If true, the colour picker is made active.public int getLastColour()
fill()
and
stroke()
.
Integer.MAX_VALUE
if no colour has yet been selected.public ColourTable getLastColourTable()
public void addPickerListener(PickerListener pickerListener)
pickerListener
- Listener to add to those informed when a colour has been chosen.public boolean removePickerListener(PickerListener pickerListener)
pickerListener
- Listener to remove from those informed when a colour has been chosen.
public void mouseClicked(java.awt.event.MouseEvent e)
PickerListener
s.
event.
mouseClicked
in interface java.awt.event.MouseListener
e
- Mouse event storing the location of the mouse click.public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
e
- Mouse event (ignored).public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
e
- Mouse event (ignored).public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
e
- Mouse event (ignored).public void mouseReleased(java.awt.event.MouseEvent e)
PickerListener
s.
mouseReleased
in interface java.awt.event.MouseListener
e
- Mouse event (ignored).public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
e
- Mouse event storing the location of the mouse drag.public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
e
- Mouse event (ignored).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |