public class ColourPicker
extends java.lang.Object
Constructor and Description |
---|
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)].
|
Modifier and Type | Method and Description |
---|---|
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 |
mouseEvent(processing.event.MouseEvent e)
Responds to mouse events by allowing colours to be picked with the mouse pointer.
|
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.
|
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.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 mouseEvent(processing.event.MouseEvent e)
e
- Mouse event.