controlP5
Class Controller

java.lang.Object
  extended by controlP5.Controller
All Implemented Interfaces:
CDrawable, ControllerInterface, ControlP5Constants
Direct Known Subclasses:
Bang, Button, Chart, Knob, Matrix, MultiList, Numberbox, Radio, Range, Slider, Slider2D, Textfield, Textlabel, Toggle

public abstract class Controller
extends java.lang.Object
implements ControllerInterface, CDrawable, ControlP5Constants

Controller is an abstract class that is extended by any available controller within controlP5. this is the full documentation list for all methods available for a controller. An event triggered by a controller will be forwarded to the main program. If a void controlEvent(ControlEvent theEvent) {} method is available, this method will be called. A Controller can pass a change in value to the main program in 3 different ways: (1) add method controlEvent(ControlEvent theEvent) to your sketch. ControlP5 will automatically detect this method and will used it to forward any controlEvent triggered by a controller - you can disable forwarding by using setBroadcast(false) (see setBroadcast) (2) each controller requires a unique name when being create. In case an existing name is used for a newly created Controller, the existing one will be overwritten. each unique name can be used to automatically link a controller to either a method or a field within your program.

See Also:
Bang, Button, Knob, Matrix, MultiList, Numberbox, Radio, ScrollList, Slider, Textarea, Textfield, Textlabel, Toggle, ControlGroup, ControlBehavior, ControlEvent
+Example
/**
 * ControlP5basics
* The following example demonstrates the basic use of controlP5.
* After initializing controlP5 you can add controllers to controlP5. * Here we use three numberboxes, one slider and one textfield. * The numberbox with name numberboxC will trigger function numberboxC() * in the example below. Whenever controlP5 detects a function in your * sketch that corresponds to the name of a controller, it will forward * an event to that function. Any event triggered by a controller * will be forwarded to function controlEvent in your sketch.
* related examples ControlP5numberbox, ControlP5slider, ControlP5textfield
* by Andreas Schlegel 2010
* */ import controlP5.*; ControlP5 controlP5; public int myColorRect = 200; public int myColorBackground = 100; void setup() { size(400,400); frameRate(25); controlP5 = new ControlP5(this); controlP5.addNumberbox("numberboxA",myColorRect,100,140,100,14).setId(1); controlP5.addNumberbox("numberboxB",myColorBackground,100,180,100,14).setId(2); controlP5.addNumberbox("numberboxC",0,100,220,100,14).setId(3); controlP5.addSlider("sliderA",100,200,100,100,260,100,14).setId(4); controlP5.addTextfield("textA",100,290,100,20).setId(5); controlP5.controller("numberboxA").setMax(255); controlP5.controller("numberboxA").setMin(0); } void draw() { background(myColorBackground); fill(myColorRect); rect(0,0,width,100); } public void numberboxC(int theValue) { println("### got an event from numberboxC : "+theValue); } // a slider event will change the value of textfield textA public void sliderA(int theValue) { ((Textfield)controlP5.controller("textA")).setValue(""+theValue); } // for every change in textfield textA, this function will be called public void textA(String theValue) { println("### got an event from textA : "+theValue); } public void controlEvent(ControlEvent theEvent) { println("got a control event from controller with id "+theEvent.controller().id()); switch(theEvent.controller().id()) { case(1): // numberboxA myColorRect = (int)(theEvent.controller().value()); break; case(2): // numberboxB myColorBackground = (int)(theEvent.controller().value()); break; } }

Field Summary
 
Fields inherited from interface controlP5.ControlP5Constants
acceptClassList, ACTIVE, ALT, ARC, ARRAY, BACKSPACE, BOOLEAN, BOTTOM, CENTER, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FIELD, FLOAT, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IMAGE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LINE, LOAD, MENU, METHOD, MOVE, OVER, PI, PRESSED, PRINT, RELEASE, RESET, RIGHT, SAVE, SHIFT, SPRITE, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, TAB, TOP, TWO_PI, UP, VERBOSE, VERTICAL
 
Method Summary
 CVector3f absolutePosition()
          get the absolute position of a controller.
 void add(ControllerInterface theElement)
           
 void addListener(ControlListener theListener)
          add a listener to the controller.
 float[] arrayValue()
           
 ControlBehavior behavior()
          get the behavior of the controller.
 Label captionLabel()
          returns the caption label of the controller.
 void changeValue(float theValue)
          set the value of the controller without sending the broadcast event.
 CColor color()
           
 void continuousUpdateEvents()
          continuousUpdateEvents is used for internal updates of a controller.
 ControlWindow controlWindow()
           
 float defaultValue()
          returns the default value.
 void disableSprite()
           
 void draw(processing.core.PApplet theApplet)
          the default draw function for each controller extending superclass Controller.
 void enableSprite()
           
 ControlP5XMLElement getAsXML()
           
 CColor getColor()
           
 int getHeight()
           
 int getPickingColor()
           
 ControllerSprite getSprite()
           
 Tab getTab()
          get the instance of the tab the controller belongs to.
 int getWidth()
           
 ControlWindow getWindow()
          get the control window of the controller
 void hide()
          hide the controller, make it invisible.
 int id()
          get the id of the controller.
 void init()
           
 boolean isBroadcast()
          check if broadcasting is enabled or disabled for a controller.
 boolean isInside()
          returns true or false and indicates if the mouse is inside the area of a controller.
 boolean isLock()
          checks if a controller is locked or unlocked.
 boolean isMousePressed()
          returns true or false if the mouse has is pressed.
 boolean isMoveable()
          checks if a controller is moveable.
 boolean isUpdate()
          enable the update function for a controller.
 boolean isUserInteraction()
           
 boolean isVisible()
          check if the controller is visible.
 boolean isXMLsavable()
           
 void keyEvent(java.awt.event.KeyEvent theEvent)
           
 java.lang.String label()
          get the label of the controller.
 Controller linebreak()
           
 int listenerSize()
           
 void lock()
          disables the controller to be moved, changed and controlled by the user.
 float max()
          get the minmum value of the controller.
 float min()
          get the maximum value of the controller.
 void moveTo(ControlGroup theGroup)
           
 void moveTo(ControlGroup theGroup, Tab theTab, ControlWindow theControlWindow)
           
 void moveTo(ControllerGroup theGroup)
           
 void moveTo(ControlWindow theControlWindow)
          move a controller to the default tab of a control window - other than the main window.
 void moveTo(ControlWindow theControlWindow, java.lang.String theTabName)
           
 void moveTo(processing.core.PApplet theApplet)
          move a controller to the default tab inside the main window.
 void moveTo(processing.core.PApplet theApplet, java.lang.String theTabName)
          move a controller to a defined tab inside the main window.
 void moveTo(java.lang.String theTabName)
          move a controller to another tab.
 void moveTo(Tab theTab)
          move a controller to another tab indicated by parameter theTab.
 java.lang.String name()
          returns the name of the controller.
 ControllerInterface parent()
          get the parent of a controller.
 void plugTo(java.lang.Object theObject)
           
 void plugTo(java.lang.Object[] theObjects)
           
 CVector3f position()
          get the position of a controller.
 void remove()
          remove a controller from controlP5.
 void remove(ControllerInterface theElement)
           
 void removeBehavior()
          remove the behavior from the controller.
 void removeListener(ControlListener theListener)
          remove a listener from the controller.
 void setArrayValue(float[] theArray)
           
 void setBehavior(ControlBehavior theBehavior)
          with setBehavior you can add a ControlBehavior to a controller.
 void setBroadcast(boolean theFlag)
          Use setBroadcast to enable and disable the broadcasting of changes in a controller's value.
 void setCaptionLabel(java.lang.String theLabel)
          set or change the content of the caption label of a controller.
 void setColor(CColor theColor)
           
 void setColorActive(int theColor)
          set the color for the controller while active.
 void setColorBackground(int theColor)
          set the background color of the controller.
 void setColorCaptionLabel(int theColor)
          set the color of the text label of the controller.
 void setColorForeground(int theColor)
          set the foreground color of the controller.
 void setColorLabel(int theColor)
          Deprecated. use setColorCaptionLabel() instead
 void setColorValue(int theColor)
          Deprecated. use setColorValueLabel() instead
 void setColorValueLabel(int theColor)
           
 void setDecimalPrecision(int theValue)
          sets the decimal precision of a controller's float value displayed.
 void setDefaultValue(float theValue)
          set the default value.
 void setDisplay(ControllerDisplay theDisplay)
          use setDisplay to customize your controller look.
 void setDisplay(ControllerDisplay theDisplay, int theMode)
           
 void setGroup(ControllerGroup theGroup)
           
 void setGroup(java.lang.String theName)
          set the group of the controller.
 Controller setHeight(int theHeight)
           
 void setId(int theId)
          set the id of the controller.
 processing.core.PImage setImage(processing.core.PImage theImage)
          Controller.DEFAULT (background) Controller.OVER (foreground) Controller.ACTIVE (active)
 processing.core.PImage setImage(processing.core.PImage theImage, int theState)
           
 Controller setImages(processing.core.PImage theImageDefault, processing.core.PImage theImageOver, processing.core.PImage theImageActive)
           
 Controller setImages(processing.core.PImage theImageDefault, processing.core.PImage theImageOver, processing.core.PImage theImageActive, processing.core.PImage theImageHighlight)
           
 void setLabel(java.lang.String theLabel)
          set the label of the controller.
 void setLabelVisible(boolean theValue)
          show or hide the labels of a controller.
 void setLock(boolean theValue)
           
 void setMax(float theValue)
          set the maximum level of the Controller.
 void setMin(float theValue)
          set the minimum level of the Controller.
 boolean setMousePressed(boolean theStatus)
           
 void setMoveable(boolean theValue)
          enable or prevent the controller to be moveable.
 void setParent(ControllerInterface theParent)
          set the parent of a parent of a controller.
 void setPosition(float theX, float theY)
          set the position of a controller.
 void setSize(int theWidth, int theHeight)
           
 void setSize(processing.core.PImage theImage)
           
 void setSprite(ControllerSprite theSprite)
           
 void setTab(ControlWindow theWindow, java.lang.String theName)
           
 void setTab(java.lang.String theName)
          set the tab of the controller.
 void setUpdate(boolean theFlag)
          disable the update function for a controller.
 void setUserInteraction(boolean theValue)
          TODO
abstract  void setValue(float theValue)
          set the value of the controller.
 void setValueLabel(java.lang.String theLabel)
          set or change the value of the value label of a controller.
 void setVisible(boolean theFlag)
          set the visibility of a controller.
 Controller setWidth(int theWidth)
           
 ControlWindow setWindow(ControlWindow theWindow)
          Deprecated.  
 void setWindow(processing.core.PApplet theApplet)
          Deprecated.  
 void show()
          show the controller.
 java.lang.String stringValue()
          set the current string value of a controller.
 java.lang.String toString()
           
 void trigger()
          Deprecated.  
 void unlock()
          enables the controller to be moved, changed and controlled by the user.
 void unplugFrom(java.lang.Object theObject)
           
 void unplugFrom(java.lang.Object[] theObjects)
           
 void update()
          updates the value of the controller without having to set the value explicitly.
 void updateAbsolutePosition()
           
 void updateEvents()
          updateEvents is used for internal updates of a controller.
 void updateInternalEvents(processing.core.PApplet theApplet)
          TODO
 Controller updateSize()
           
 float value()
          get the current value of the controller.
 Label valueLabel()
          returns the caption label of the controller.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface controlP5.ControllerInterface
addToXMLElement
 

Method Detail

init

public final void init()
Specified by:
init in interface ControllerInterface

setBehavior

public void setBehavior(ControlBehavior theBehavior)
with setBehavior you can add a ControlBehavior to a controller. A ControlBehavior can be used to e.g. automatically change state, function, position, etc.

Parameters:
theBehavior - ControlBehavior
+Example
/**
 * ControlP5behavior
* ControlBehavior is an abstract class that can be extended using your * custom control behaviors. What is a control behavior? Control Behaviors * allow you to automate and dynamically change the state or value of a * controller. One behavior per controller is currently supported. i case you * need to use more that one bahavior, the implementation has to happen * on your side - inside your control behavior.
* by Andreas Schlegel 2010
* */ import controlP5.*; ControlP5 controlP5; int myColorBackground = color(0,0,0); public int sliderValue = 100; void setup() { size(400,400); frameRate(30); controlP5 = new ControlP5(this); controlP5.addSlider("sliderValue",0,255,128,100,50 + height/2,40,100); controlP5.addSlider("slider",100,255,128,100,50,100,40); controlP5.addBang("bang",40,50 + height/2,40,40); // add a custom ControlBehavior to controller bang, // class TimerEvent is included in this sketch at the bottom // and extends abstract class ControlBehavior. controlP5.controller("bang").setBehavior(new TimedEvent()); // use an anonymous class of type ControlBehavior. controlP5.controller("slider").setBehavior(new ControlBehavior() { float a = 0; public void update() { setValue(sin(a += 0.1) * 50 + 150); } }); } void draw() { background(myColorBackground); fill(sliderValue); rect(0,0,width,height/2); } void slider(float theColor) { myColorBackground = color(theColor); println("# a slider event. setting background to "+theColor); } public void bang() { println("# an event received from controller bang."); // a bang will set the value of controller sliderValue // to a random number between 0 and 255. controlP5.controller("sliderValue").setValue(random(0,255)); } // custom ControlBehavior class TimedEvent extends ControlBehavior { long myTime; int interval = 200; public TimedEvent() { reset(); } void reset() { myTime = millis() + interval; } public void update() { if(millis()>myTime) { setValue(1); reset(); } } }

removeBehavior

public void removeBehavior()
remove the behavior from the controller.


behavior

public ControlBehavior behavior()
get the behavior of the controller.

Returns:
ControlBehavior

defaultValue

public float defaultValue()
returns the default value.

Returns:
float

setDefaultValue

public void setDefaultValue(float theValue)
set the default value.

Parameters:
theValue - float

setMoveable

public void setMoveable(boolean theValue)
enable or prevent the controller to be moveable. By default a controller is moveable.

Parameters:
theValue - boolean

isMoveable

public boolean isMoveable()
checks if a controller is moveable.

Returns:

setLabelVisible

public void setLabelVisible(boolean theValue)
show or hide the labels of a controller.

Parameters:
theValue - boolean

setBroadcast

public void setBroadcast(boolean theFlag)
Use setBroadcast to enable and disable the broadcasting of changes in a controller's value. By default any value changes are forwarded to function controlEvent inside your program. use setBroadcast(false) to disable forwarding.

Parameters:
theFlag - boolean

isBroadcast

public boolean isBroadcast()
check if broadcasting is enabled or disabled for a controller. Every event relevant for a value change will be broadcasted to any of the value-listeners. By default broadcasting for a controller is enabled.

Returns:
boolean

position

public CVector3f position()
get the position of a controller. e.g. Controller.position().x();

Specified by:
position in interface ControllerInterface
Returns:
CVector3f

setPosition

public void setPosition(float theX,
                        float theY)
set the position of a controller. The position of a controller is relative.

Specified by:
setPosition in interface ControllerInterface
Parameters:
theX - float
theY - float

absolutePosition

public CVector3f absolutePosition()
get the absolute position of a controller. if a controller is the child of another controller, the absolute position is the sum of its parent(s) position(s).

Specified by:
absolutePosition in interface ControllerInterface
Returns:
CVector3f

updateAbsolutePosition

public void updateAbsolutePosition()
Specified by:
updateAbsolutePosition in interface ControllerInterface

continuousUpdateEvents

public final void continuousUpdateEvents()
continuousUpdateEvents is used for internal updates of a controller. this method is final and can't be overwritten.

Specified by:
continuousUpdateEvents in interface ControllerInterface

updateEvents

public final void updateEvents()
updateEvents is used for internal updates of a controller. this method is final and can't be overwritten.

Specified by:
updateEvents in interface ControllerInterface

updateInternalEvents

public void updateInternalEvents(processing.core.PApplet theApplet)
TODO

Specified by:
updateInternalEvents in interface ControllerInterface
See Also:
ControllerInterface.updateInternalEvents

draw

public void draw(processing.core.PApplet theApplet)
the default draw function for each controller extending superclass Controller. This draw function will take care of default matrix operations and will call the display function of the current ControllerDisplay object active for this particular controller.

Specified by:
draw in interface CDrawable
Specified by:
draw in interface ControllerInterface
Parameters:
theApplet - PApplet
See Also:
ControllerDisplay

add

public void add(ControllerInterface theElement)
Specified by:
add in interface ControllerInterface
Parameters:
theElement - ControllerInterface

remove

public void remove(ControllerInterface theElement)
Specified by:
remove in interface ControllerInterface
Parameters:
theElement - ControllerInterface

remove

public void remove()
remove a controller from controlP5.

Specified by:
remove in interface ControllerInterface

name

public java.lang.String name()
returns the name of the controller.

Specified by:
name in interface ControllerInterface
Returns:
String

moveTo

public void moveTo(java.lang.String theTabName)
move a controller to another tab. The tab is defined by parameter theTabName. if controlP5 can't find a tab with such name, controlP5 will create this tab and add it to the main window.

Parameters:
theTabName - String

moveTo

public void moveTo(Tab theTab)
move a controller to another tab indicated by parameter theTab.

Parameters:
theTab -

moveTo

public void moveTo(processing.core.PApplet theApplet)
move a controller to the default tab inside the main window.

Parameters:
theApplet -

moveTo

public void moveTo(processing.core.PApplet theApplet,
                   java.lang.String theTabName)
move a controller to a defined tab inside the main window.

Parameters:
theApplet -
theTabName -

moveTo

public void moveTo(ControlWindow theControlWindow)
move a controller to the default tab of a control window - other than the main window.

Parameters:
theControlWindow -

moveTo

public void moveTo(ControlWindow theControlWindow,
                   java.lang.String theTabName)

moveTo

public void moveTo(ControlGroup theGroup,
                   Tab theTab,
                   ControlWindow theControlWindow)
Specified by:
moveTo in interface ControllerInterface
Parameters:
theGroup - ControlGroup
theTab - Tab
theControlWindow - ControlWindow

moveTo

public void moveTo(ControlGroup theGroup)

moveTo

public void moveTo(ControllerGroup theGroup)

setTab

public void setTab(java.lang.String theName)
set the tab of the controller.

Parameters:
theName - String

setTab

public void setTab(ControlWindow theWindow,
                   java.lang.String theName)

setGroup

public void setGroup(java.lang.String theName)
set the group of the controller.

Parameters:
theName - String

setGroup

public void setGroup(ControllerGroup theGroup)

setWindow

public void setWindow(processing.core.PApplet theApplet)
Deprecated. 

Parameters:
theApplet - PApplet

setWindow

public ControlWindow setWindow(ControlWindow theWindow)
Deprecated. 

Parameters:
theWindwo - ControlWindow

getTab

public Tab getTab()
get the instance of the tab the controller belongs to.

Specified by:
getTab in interface ControllerInterface
Returns:
Tab

setParent

public final void setParent(ControllerInterface theParent)
set the parent of a parent of a controller. this method is only meant for internal use.this method is final and can't be overwritten.

Parameters:
theParent - ControllerInterface

parent

public ControllerInterface parent()
get the parent of a controller.

Specified by:
parent in interface ControllerInterface
Returns:

getWindow

public ControlWindow getWindow()
get the control window of the controller

Specified by:
getWindow in interface ControllerInterface
Returns:
ControlWindow

isInside

public boolean isInside()
returns true or false and indicates if the mouse is inside the area of a controller.

Returns:
boolean

isMousePressed

public boolean isMousePressed()
returns true or false if the mouse has is pressed.

Returns:
boolean

setMousePressed

public final boolean setMousePressed(boolean theStatus)
Specified by:
setMousePressed in interface ControllerInterface
Parameters:
theStatus - boolean
Returns:
boolean

keyEvent

public void keyEvent(java.awt.event.KeyEvent theEvent)
Specified by:
keyEvent in interface ControllerInterface
Parameters:
KeyEvent - theEvent

setId

public void setId(int theId)
set the id of the controller.

Specified by:
setId in interface ControllerInterface
Parameters:
int - theId

id

public int id()
get the id of the controller.

Specified by:
id in interface ControllerInterface
Returns:
int

plugTo

public void plugTo(java.lang.Object[] theObjects)
Parameters:
theObject -

plugTo

public void plugTo(java.lang.Object theObject)

unplugFrom

public void unplugFrom(java.lang.Object[] theObjects)

unplugFrom

public void unplugFrom(java.lang.Object theObject)

setValue

public abstract void setValue(float theValue)
set the value of the controller.

Parameters:
theValue - float

setArrayValue

public void setArrayValue(float[] theArray)

changeValue

public final void changeValue(float theValue)
set the value of the controller without sending the broadcast event. this function is final.

Parameters:
theValue - float

update

public void update()
updates the value of the controller without having to set the value explicitly. update does not visually update the controller. the updating status can be set with setUpdate(true/false) and checked with isUpdate(). setUpdate ( )

Specified by:
update in interface ControllerInterface

setUpdate

public void setUpdate(boolean theFlag)
disable the update function for a controller. update ( )

Specified by:
setUpdate in interface ControllerInterface
Parameters:
theFlag - boolean

isUpdate

public boolean isUpdate()
enable the update function for a controller. setUpdate ( )

Specified by:
isUpdate in interface ControllerInterface
Returns:
boolean

trigger

public void trigger()
Deprecated. 

trigger the event of a controller. deprecated. use .update() instead.


value

public float value()
get the current value of the controller.

Specified by:
value in interface ControllerInterface
Returns:
float

stringValue

public java.lang.String stringValue()
set the current string value of a controller.

Specified by:
stringValue in interface ControllerInterface
Returns:
String

arrayValue

public float[] arrayValue()

getPickingColor

public int getPickingColor()
Specified by:
getPickingColor in interface ControllerInterface

color

public CColor color()
Specified by:
color in interface ControllerInterface
Returns:
CColor

getColor

public CColor getColor()

setLabel

public void setLabel(java.lang.String theLabel)
set the label of the controller.

Specified by:
setLabel in interface ControllerInterface
Parameters:
theLabel - String

setCaptionLabel

public void setCaptionLabel(java.lang.String theLabel)
set or change the content of the caption label of a controller.

Parameters:
theLabel -

setValueLabel

public void setValueLabel(java.lang.String theLabel)
set or change the value of the value label of a controller. (this is cheating, but maybe useful for some cases.)

Parameters:
theLabel -

label

public java.lang.String label()
get the label of the controller.

Returns:
String

addListener

public void addListener(ControlListener theListener)
add a listener to the controller. ControlListener

Parameters:
theListener - ControlListener

removeListener

public void removeListener(ControlListener theListener)
remove a listener from the controller. ControlListener

Parameters:
theListener - ControlListener

listenerSize

public int listenerSize()
Returns:
int

isVisible

public boolean isVisible()
check if the controller is visible.

Specified by:
isVisible in interface ControllerInterface
Returns:
boolean

setVisible

public void setVisible(boolean theFlag)
set the visibility of a controller.

Parameters:
theFlag - boolean

hide

public void hide()
hide the controller, make it invisible.

Specified by:
hide in interface ControllerInterface

show

public void show()
show the controller. make it visible.

Specified by:
show in interface ControllerInterface

setColor

public void setColor(CColor theColor)

setColorActive

public void setColorActive(int theColor)
set the color for the controller while active.

Specified by:
setColorActive in interface ControllerInterface
Parameters:
theColor - int

setColorForeground

public void setColorForeground(int theColor)
set the foreground color of the controller.

Specified by:
setColorForeground in interface ControllerInterface
Parameters:
theColor - int

setColorBackground

public void setColorBackground(int theColor)
set the background color of the controller.

Specified by:
setColorBackground in interface ControllerInterface
Parameters:
theColor - int

setColorLabel

public void setColorLabel(int theColor)
Deprecated. use setColorCaptionLabel() instead

Specified by:
setColorLabel in interface ControllerInterface
Parameters:
theColor - int

setColorCaptionLabel

public void setColorCaptionLabel(int theColor)
set the color of the text label of the controller.

Parameters:
theColor -

setColorValue

public void setColorValue(int theColor)
Deprecated. use setColorValueLabel() instead

set the color of the value label of the controller.

Specified by:
setColorValue in interface ControllerInterface
Parameters:
theColor - int

setColorValueLabel

public void setColorValueLabel(int theColor)

setImages

public Controller setImages(processing.core.PImage theImageDefault,
                            processing.core.PImage theImageOver,
                            processing.core.PImage theImageActive)

setImages

public Controller setImages(processing.core.PImage theImageDefault,
                            processing.core.PImage theImageOver,
                            processing.core.PImage theImageActive,
                            processing.core.PImage theImageHighlight)

setImage

public processing.core.PImage setImage(processing.core.PImage theImage)
Controller.DEFAULT (background) Controller.OVER (foreground) Controller.ACTIVE (active)

Parameters:
theImage -

setImage

public processing.core.PImage setImage(processing.core.PImage theImage,
                                       int theState)

updateSize

public Controller updateSize()

setSize

public void setSize(processing.core.PImage theImage)

setSize

public void setSize(int theWidth,
                    int theHeight)

setDisplay

public void setDisplay(ControllerDisplay theDisplay)
use setDisplay to customize your controller look. A new controller-display class required to implement interface ControllerDisplay. By default the display mode will be set to CUSTOM when setting a new display.

Parameters:
theDisplay -
See Also:
ControllerDisplay

setDisplay

public void setDisplay(ControllerDisplay theDisplay,
                       int theMode)

captionLabel

public Label captionLabel()
returns the caption label of the controller.

Returns:
See Also:
Label

valueLabel

public Label valueLabel()
returns the caption label of the controller.

Returns:
See Also:
Label

max

public float max()
get the minmum value of the controller.

Returns:
float

min

public float min()
get the maximum value of the controller.

Returns:
float

setMin

public void setMin(float theValue)
set the minimum level of the Controller.

Parameters:
theValue - float

setMax

public void setMax(float theValue)
set the maximum level of the Controller.

Parameters:
theValue - float

setWidth

public Controller setWidth(int theWidth)

setHeight

public Controller setHeight(int theHeight)

getWidth

public int getWidth()
Specified by:
getWidth in interface ControllerInterface

getHeight

public int getHeight()
Specified by:
getHeight in interface ControllerInterface

setDecimalPrecision

public void setDecimalPrecision(int theValue)
sets the decimal precision of a controller's float value displayed. the precision does not apply to the returned float value.

Parameters:
theValue -

controlWindow

public ControlWindow controlWindow()

setSprite

public void setSprite(ControllerSprite theSprite)

getSprite

public ControllerSprite getSprite()

enableSprite

public void enableSprite()

disableSprite

public void disableSprite()

lock

public void lock()
disables the controller to be moved, changed and controlled by the user.


unlock

public void unlock()
enables the controller to be moved, changed and controlled by the user.


isLock

public boolean isLock()
checks if a controller is locked or unlocked.

Returns:

setLock

public void setLock(boolean theValue)

setUserInteraction

public void setUserInteraction(boolean theValue)
TODO


isUserInteraction

public boolean isUserInteraction()

isXMLsavable

public boolean isXMLsavable()
Specified by:
isXMLsavable in interface ControllerInterface
Returns:
boolean

linebreak

public Controller linebreak()

getAsXML

public ControlP5XMLElement getAsXML()
Specified by:
getAsXML in interface ControllerInterface
Returns:
ControlP5XMLElement

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


processing library controlP5 by Andreas Schlegel. (c) 2010