controlP5
Class ControlP5

java.lang.Object
  extended by controlP5.ControlP5
All Implemented Interfaces:
ControlP5Constants

public class ControlP5
extends java.lang.Object
implements ControlP5Constants

controlP5 is a processing and java library for creating simple control GUIs.


Field Summary
 CColor color
           
 ControlWindow controlWindow
           
static boolean DEBUG
           
static int grixel
           
static boolean isApplet
           
static ControlWindowKeyHandler keyHandler
           
static processing.core.PApplet papplet
           
static int standard56
           
static int standard58
           
static int synt24
           
static java.lang.String VERSION
           
 
Fields inherited from interface controlP5.ControlP5Constants
acceptClassList, ALT, ARRAY, BACKSPACE, BOOLEAN, CONTROL, DECREASE, DELETE, DOWN, ENTER, ESCAPE, eventMethod, FIELD, FLOAT, HALF_PI, HIDE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LOAD, MENU, METHOD, PI, PRINT, RESET, RIGHT, SAVE, SHIFT, STRING, SWITCH_BACK, SWITCH_FORE, TAB, TWO_PI, UP, VERBOSE
 
Constructor Summary
ControlP5(processing.core.PApplet theParent)
          instantiate controlP5.
ControlP5(processing.core.PApplet theParent, ControlFont theControlFont)
           
 
Method Summary
 Bang addBang(java.lang.String theName, int theX, int theY, int theWidth, int theHeight)
          add a bang to controlP5.
 Button addButton(java.lang.String theName, float theValue, int theX, int theY, int theW, int theH)
          a button to controlP5.
 CheckBox addCheckBox(java.lang.String theName, int theX, int theY)
           
 ControlWindow addControlWindow(java.lang.String theWindowName, int theWidth, int theHeight)
          create a new ControlWindow.
 ControlWindow addControlWindow(java.lang.String theWindowName, int theX, int theY, int theWidth, int theHeight)
           
 ControlWindow addControlWindow(java.lang.String theWindowName, int theX, int theY, int theWidth, int theHeight, int theFrameRate)
           
 ControlWindow addControlWindow(java.lang.String theWindowName, int theX, int theY, int theWidth, int theHeight, java.lang.String theRenderer, int theFrameRate)
          create a new ControlWindow.
 ControlGroup addGroup(java.lang.String theName, int theX, int theY)
           
 ControlGroup addGroup(java.lang.String theName, int theX, int theY, int theW)
          add a group to controlP5.
 Knob addKnob(java.lang.String theName, float theMin, float theMax, float theDefaultValue, int theX, int theY, int theDiameter)
          add a knob to controlP5.
 Knob addKnob(java.lang.String theName, float theMin, float theMax, int theX, int theY, int theDiameter)
          add a knob to your controlP5 setup.
 ListBox addListBox(java.lang.String theName, int theX, int theY, int theW, int theH)
           
 Matrix addMatrix(java.lang.String theName, int theCellX, int theCellY, int theX, int theY, int theWidth, int theHeight)
           
 MultiList addMultiList(java.lang.String theName, int theX, int theY, int theWidth, int theHeight)
           
 Numberbox addNumberbox(java.lang.String theName, float theDefaultValue, int theX, int theY, int theWidth, int theHeight)
          add a numberbox to controlP5.
 Numberbox addNumberbox(java.lang.String theName, int theX, int theY, int theWidth, int theHeight)
          add a numberbox to controlP5.
 Radio addRadio(java.lang.String theName, int theX, int theY)
          add a radio list to controlP5.
 Radio addRadio(java.lang.String theName, int theX, int theY, int theWidth, int theHeight, int theLineSpacing)
           
 RadioButton addRadioButton(java.lang.String theName, int theX, int theY)
           
 Range addRange(java.lang.String theName, float theMin, float theMax, float theDefaultMinValue, float theDefaultMaxValue, int theX, int theY, int theW, int theH)
           
 Range addRange(java.lang.String theName, float theMin, float theMax, int theX, int theY, int theWidth, int theHeight)
          add a slider to controlP5.
 ScrollList addScrollList(java.lang.String theName, int theX, int theY, int theW, int theH)
          add a scroll list to controlP5.
 Slider addSlider(java.lang.String theName, float theMin, float theMax, float theDefaultValue, int theX, int theY, int theW, int theH)
          add a slider to controlP5.
 Slider addSlider(java.lang.String theName, float theMin, float theMax, int theX, int theY, int theWidth, int theHeight)
          add a slider to controlP5.
 Tab addTab(ControlWindow theWindow, java.lang.String theName)
           
 Tab addTab(processing.core.PApplet theWindow, java.lang.String theName)
           
 Tab addTab(java.lang.String theName)
          add a tab to controlP5.
 Textarea addTextarea(java.lang.String theName, java.lang.String theText, int theX, int theY, int theW, int theH)
          add a textlabel to controlP5.
 Textfield addTextfield(java.lang.String theName, int theX, int theY, int theW, int theH)
          add a textfield to controlP5.
 Textlabel addTextlabel(java.lang.String theName, java.lang.String theText, int theX, int theY)
           
 Toggle addToggle(java.lang.String theName, boolean theDefaultValue, float theX, float theY, int theWidth, int theHeight)
          add a toggle to controlP5.
 Toggle addToggle(java.lang.String theName, float theX, float theY, int theWidth, int theHeight)
          add a toggle to controlP5.
 ControlBroadcaster controlbroadcaster()
           
 Controller controller(java.lang.String theName)
          get a controller by name.
 void draw()
           
 java.lang.String filePath()
          get the current file path where your controlP5 setup will be save to on your local disk.
static ControlFont getControlFont()
           
 ControllerInterface[] getControllerList()
           
 ControllerGroup getGroup(java.lang.String theGroupName)
          get a group by name.
 Tab getTab(ControlWindow theWindow, java.lang.String theName)
          get a tab by name from a specific controlwindow.
 Tab getTab(java.lang.String theName)
          get a tab by name.
 ControllerGroup group(java.lang.String theGroupName)
          get a group by name
 void hide()
          hide all controllers and tabs in your sketch.
 boolean isAutoDraw()
          check if the autoDraw function for the main window is enabled(true) or disabled(false).
 boolean isUpdate()
           
 boolean isVisible()
           
 boolean load(java.lang.String theFileName)
          load an xml file, containing a controlP5 setup
 void lock()
          lock ControlP5 to disable moving Controllers around.
 void register(ControllerInterface theController)
           
 void remove(java.lang.String theString)
          remove a controlP5 element such as a controller, group, or tab by name.
 boolean save()
          save controlP5 settings to your local disk or to a remote server.
 boolean save(java.lang.String theFilePath)
          save controlP5 settings to your local disk or to a remote server.
 void setAutoDraw(boolean theFlag)
          by default controlP5 draws any controller on top of any drawing done in the draw() function (this doesnt apply to P3D where controlP5.draw() has to be called manually in the sketch's draw() function ).
 void setAutoInitialization(boolean theFlag)
          autoInitialization can be very handy when it comes to initializing values, e.g.
 void setColorActive(int theColor)
          set the active state color of tabs and controllers.
 void setColorBackground(int theColor)
          set the backgorund color of tabs and controllers.
 void setColorForeground(int theColor)
          set the foreground color of tabs and controllers.
 void setColorLabel(int theColor)
          set the label color of tabs and controllers.
 void setColorValue(int theColor)
          set the value color of controllers.
 boolean setControlFont(ControlFont theControlFont)
           
 boolean setControlFont(processing.core.PFont thePFont)
           
 boolean setControlFont(processing.core.PFont thePFont, int theFontSize)
           
 void setFilePath(java.lang.String theFilePath)
          set the path / filename of the xml file your controlP5 setup will be saved to.
 void setTabEventsActive(boolean theFlag)
           
 void setUpdate(boolean theFlag)
           
 void setUrlPath(java.lang.String theUrlPath)
          you can set an url an e.g.
 void setUrlPath(java.lang.String theUrlPath, java.lang.String theFilename)
          you can set an url e.g.
 void show()
          show all controllers and tabs in your sketch.
 Tab tab(ControlWindow theWindow, java.lang.String theName)
          get a tab by name from a specific controlwindow.
 Tab tab(java.lang.String theName)
          get a tab by name.
 void trigger()
          Deprecated.  
 void unlock()
          unlock ControlP5 to enable moving Controllers around.
 void update()
           
 java.lang.String urlPath()
          get the current url path where your controlP5 setup will be save to a remote server e.g.
 java.lang.String version()
          get the current version of controlP5
 ControlWindow window(processing.core.PApplet theApplet)
           
 ControlWindow window(java.lang.String theWindowName)
          get a ControlWindow by name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

controlWindow

public ControlWindow controlWindow

color

public CColor color

standard58

public static final int standard58
See Also:
Constant Field Values

standard56

public static final int standard56
See Also:
Constant Field Values

synt24

public static final int synt24
See Also:
Constant Field Values

grixel

public static final int grixel
See Also:
Constant Field Values

keyHandler

public static ControlWindowKeyHandler keyHandler

papplet

public static processing.core.PApplet papplet

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

isApplet

public static boolean isApplet

DEBUG

public static boolean DEBUG
Constructor Detail

ControlP5

public ControlP5(processing.core.PApplet theParent)
instantiate controlP5.

Parameters:
theParent - PApplet

ControlP5

public ControlP5(processing.core.PApplet theParent,
                 ControlFont theControlFont)
Method Detail

setTabEventsActive

public void setTabEventsActive(boolean theFlag)

setAutoInitialization

public void setAutoInitialization(boolean theFlag)
autoInitialization can be very handy when it comes to initializing values, e.g. you load a set of controllers from an xml file, then the values that are attached to the controllers will be reset to its state saved in the xml file. to turn of auto intialization, call setAutoInitialization(false) right after initializing controlP5 and before creating any controller.

Parameters:
theFlag - boolean

setAutoDraw

public void setAutoDraw(boolean theFlag)
by default controlP5 draws any controller on top of any drawing done in the draw() function (this doesnt apply to P3D where controlP5.draw() has to be called manually in the sketch's draw() function ). to turn off the auto drawing of controlP5, use controlP5.setAutoDraw(false). now you can call controlP5.draw() any time whenever controllers should be drawn into the sketch.

Parameters:
theFlag - boolean

isAutoDraw

public boolean isAutoDraw()
check if the autoDraw function for the main window is enabled(true) or disabled(false).

Returns:
boolean

controlbroadcaster

public ControlBroadcaster controlbroadcaster()
Returns:
ControlBroadcaster

addTab

public Tab addTab(java.lang.String theName)
add a tab to controlP5. by default the tab will be added to the main window.

Parameters:
theName - String
Returns:
Tasaveb

addTab

public Tab addTab(processing.core.PApplet theWindow,
                  java.lang.String theName)

addTab

public Tab addTab(ControlWindow theWindow,
                  java.lang.String theName)

tab

public Tab tab(java.lang.String theName)
get a tab by name.

Parameters:
theName - String
Returns:
Tab

getTab

public Tab getTab(java.lang.String theName)
get a tab by name.

Parameters:
theName - String
Returns:
Tab

tab

public Tab tab(ControlWindow theWindow,
               java.lang.String theName)
get a tab by name from a specific controlwindow.

Parameters:
theWindow - ControlWindow
theName - String
Returns:
Tab

getTab

public Tab getTab(ControlWindow theWindow,
                  java.lang.String theName)
get a tab by name from a specific controlwindow.

Parameters:
theWindow - ControlWindow
theName - String
Returns:
Tab

addButton

public Button addButton(java.lang.String theName,
                        float theValue,
                        int theX,
                        int theY,
                        int theW,
                        int theH)
a button to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theValue - float
theX - int
theY - int
theW - int
theH - int
Returns:
Button

addBang

public Bang addBang(java.lang.String theName,
                    int theX,
                    int theY,
                    int theWidth,
                    int theHeight)
add a bang to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theX - int
theY - int
theWidth - int
theHeight - int
Returns:
Bang

addToggle

public Toggle addToggle(java.lang.String theName,
                        boolean theDefaultValue,
                        float theX,
                        float theY,
                        int theWidth,
                        int theHeight)
add a toggle to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theDefaultValue - boolean
theX - float
theY - float
theWidth - int
theHeight - int
Returns:
Toggle

addToggle

public Toggle addToggle(java.lang.String theName,
                        float theX,
                        float theY,
                        int theWidth,
                        int theHeight)
add a toggle to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theDefaultValue - boolean
theX - float
theY - float
theWidth - int
theHeight - int
Returns:
Toggle

addMatrix

public Matrix addMatrix(java.lang.String theName,
                        int theCellX,
                        int theCellY,
                        int theX,
                        int theY,
                        int theWidth,
                        int theHeight)

addSlider

public Slider addSlider(java.lang.String theName,
                        float theMin,
                        float theMax,
                        float theDefaultValue,
                        int theX,
                        int theY,
                        int theW,
                        int theH)
add a slider to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theMin - float
theMax - float
theDefaultValue - float
theX - int
theY - int
theW - int
theH - int
Returns:
Slider

addSlider

public Slider addSlider(java.lang.String theName,
                        float theMin,
                        float theMax,
                        int theX,
                        int theY,
                        int theWidth,
                        int theHeight)
add a slider to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theMin - float
theMax - float
theX - int
theY - int
theWidth - int
theHeight - int
Returns:
Slider

addRange

public Range addRange(java.lang.String theName,
                      float theMin,
                      float theMax,
                      float theDefaultMinValue,
                      float theDefaultMaxValue,
                      int theX,
                      int theY,
                      int theW,
                      int theH)

addRange

public Range addRange(java.lang.String theName,
                      float theMin,
                      float theMax,
                      int theX,
                      int theY,
                      int theWidth,
                      int theHeight)
add a slider to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theMin - float
theMax - float
theX - int
theY - int
theWidth - int
theHeight - int
Returns:
Slider

addNumberbox

public Numberbox addNumberbox(java.lang.String theName,
                              int theX,
                              int theY,
                              int theWidth,
                              int theHeight)
add a numberbox to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theX - float
theY - float
theWidth - int
theHeight - int
Returns:
Numberbox

addNumberbox

public Numberbox addNumberbox(java.lang.String theName,
                              float theDefaultValue,
                              int theX,
                              int theY,
                              int theWidth,
                              int theHeight)
add a numberbox to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theDefaultValue - int
theX - float
theY - float
theWidth - int
theHeight - int
Returns:
Numberbox

addKnob

public Knob addKnob(java.lang.String theName,
                    float theMin,
                    float theMax,
                    int theX,
                    int theY,
                    int theDiameter)
add a knob to your controlP5 setup.

Parameters:
theName - String
theMin - float
theMax - float
theX - float
theY - float
theDiameter - int
Returns:
Knob

addMultiList

public MultiList addMultiList(java.lang.String theName,
                              int theX,
                              int theY,
                              int theWidth,
                              int theHeight)

addKnob

public Knob addKnob(java.lang.String theName,
                    float theMin,
                    float theMax,
                    float theDefaultValue,
                    int theX,
                    int theY,
                    int theDiameter)
add a knob to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theMin - float
theMax - float
theDefaultValue - float
theX - float
theY - float
theDiameter - int
Returns:
Knob

addTextarea

public Textarea addTextarea(java.lang.String theName,
                            java.lang.String theText,
                            int theX,
                            int theY,
                            int theW,
                            int theH)
add a textlabel to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theText - String
theX - int
theY - int
theW - int
theH - int
Returns:
Textlabel

addTextlabel

public Textlabel addTextlabel(java.lang.String theName,
                              java.lang.String theText,
                              int theX,
                              int theY)

addTextfield

public Textfield addTextfield(java.lang.String theName,
                              int theX,
                              int theY,
                              int theW,
                              int theH)
add a textfield to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theX - int
theY - int
theW - int
theH - int
Returns:
Textfield

addRadio

public Radio addRadio(java.lang.String theName,
                      int theX,
                      int theY)
add a radio list to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theX - int
theY - int
Returns:
Radio

addRadio

public Radio addRadio(java.lang.String theName,
                      int theX,
                      int theY,
                      int theWidth,
                      int theHeight,
                      int theLineSpacing)

addRadioButton

public RadioButton addRadioButton(java.lang.String theName,
                                  int theX,
                                  int theY)

addCheckBox

public CheckBox addCheckBox(java.lang.String theName,
                            int theX,
                            int theY)

addScrollList

public ScrollList addScrollList(java.lang.String theName,
                                int theX,
                                int theY,
                                int theW,
                                int theH)
add a scroll list to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theX - int
theY - int
theW - int
theH - int
Returns:
ScrollList

addListBox

public ListBox addListBox(java.lang.String theName,
                          int theX,
                          int theY,
                          int theW,
                          int theH)

addGroup

public ControlGroup addGroup(java.lang.String theName,
                             int theX,
                             int theY,
                             int theW)
add a group to controlP5. by default it will be added to the default tab of the main window.

Parameters:
theName - String
theX - int
theY - int
Returns:
ControlGroup

addGroup

public ControlGroup addGroup(java.lang.String theName,
                             int theX,
                             int theY)

register

public void register(ControllerInterface theController)
Parameters:
theController - ControllerInterface

getControllerList

public ControllerInterface[] getControllerList()

remove

public void remove(java.lang.String theString)
remove a controlP5 element such as a controller, group, or tab by name.

Parameters:
theString - String

controller

public Controller controller(java.lang.String theName)
get a controller by name. you will have to cast the controller.

Parameters:
theName - String
Returns:
Controller

group

public ControllerGroup group(java.lang.String theGroupName)
get a group by name

Parameters:
theGroupName - String
Returns:
ControllerGroup

getGroup

public ControllerGroup getGroup(java.lang.String theGroupName)
get a group by name.

Parameters:
theGroupName - String
Returns:
ControllerGroup

draw

public void draw()

addControlWindow

public ControlWindow addControlWindow(java.lang.String theWindowName,
                                      int theWidth,
                                      int theHeight)
create a new ControlWindow.

Parameters:
theWindowName - String
theWidth - int
theHeight - int
Returns:
ControlWindow

addControlWindow

public ControlWindow addControlWindow(java.lang.String theWindowName,
                                      int theX,
                                      int theY,
                                      int theWidth,
                                      int theHeight)

addControlWindow

public ControlWindow addControlWindow(java.lang.String theWindowName,
                                      int theX,
                                      int theY,
                                      int theWidth,
                                      int theHeight,
                                      int theFrameRate)

addControlWindow

public ControlWindow addControlWindow(java.lang.String theWindowName,
                                      int theX,
                                      int theY,
                                      int theWidth,
                                      int theHeight,
                                      java.lang.String theRenderer,
                                      int theFrameRate)
create a new ControlWindow.

Parameters:
theWindowName - String
theX - int
theY - int
theWidth - int
theHeight - int
Returns:
ControlWindow

window

public ControlWindow window(processing.core.PApplet theApplet)

window

public ControlWindow window(java.lang.String theWindowName)
get a ControlWindow by name.

Parameters:
theName - String
Returns:
ControlWindow

setFilePath

public void setFilePath(java.lang.String theFilePath)
set the path / filename of the xml file your controlP5 setup will be saved to.

Parameters:
theFilename - String

setUrlPath

public void setUrlPath(java.lang.String theUrlPath)
you can set an url an e.g. index.php file on a server where you want to save your controlP5 setup to.

Parameters:
theUrlPath - String

setUrlPath

public void setUrlPath(java.lang.String theUrlPath,
                       java.lang.String theFilename)
you can set an url e.g. an index.php file on a server where you want to save your controlP5 setup to.

Parameters:
theUrlPath - String
theFilename - String

filePath

public java.lang.String filePath()
get the current file path where your controlP5 setup will be save to on your local disk.

Returns:
String

urlPath

public java.lang.String urlPath()
get the current url path where your controlP5 setup will be save to a remote server e.g. a webserver.

Returns:
String

setColorActive

public void setColorActive(int theColor)
set the active state color of tabs and controllers.

Parameters:
theColor - int

setColorForeground

public void setColorForeground(int theColor)
set the foreground color of tabs and controllers.

Parameters:
theColor - int

setColorBackground

public void setColorBackground(int theColor)
set the backgorund color of tabs and controllers.

Parameters:
theColor - int

setColorLabel

public void setColorLabel(int theColor)
set the label color of tabs and controllers.

Parameters:
theColor - int

setColorValue

public void setColorValue(int theColor)
set the value color of controllers.

Parameters:
theColor - int

lock

public void lock()
lock ControlP5 to disable moving Controllers around.


unlock

public void unlock()
unlock ControlP5 to enable moving Controllers around.


save

public boolean save(java.lang.String theFilePath)
save controlP5 settings to your local disk or to a remote server. a file controlP5.xml will be written to the data folder of your sketch. you can set another file path with method setFilePath(). to save a file to a remote server set the url with setUrlPath() e.g. setUrlPath("http://yourdomain.com/controlP5/upload.php");

Parameters:
theFilename - String
Returns:
boolean

save

public boolean save()
save controlP5 settings to your local disk or to a remote server. a file controlP5.xml will be written to the data folder of your sketch. you can set another file path with method setFilePath(). to save a file to a remote server set the url with setUrlPath() e.g. setUrlPath("http://yourdomain.com/controlP5/upload.php");

Returns:
boolean

load

public boolean load(java.lang.String theFileName)
load an xml file, containing a controlP5 setup

Parameters:
theFileName -

version

public java.lang.String version()
get the current version of controlP5

Returns:
String

show

public void show()
show all controllers and tabs in your sketch.


isVisible

public boolean isVisible()

hide

public void hide()
hide all controllers and tabs in your sketch.


update

public void update()

isUpdate

public boolean isUpdate()

setUpdate

public void setUpdate(boolean theFlag)

trigger

public void trigger()
Deprecated. 

forces each available controller to broadcast its value. deprecated. use .update() instead.


setControlFont

public boolean setControlFont(ControlFont theControlFont)

setControlFont

public boolean setControlFont(processing.core.PFont thePFont,
                              int theFontSize)

setControlFont

public boolean setControlFont(processing.core.PFont thePFont)

getControlFont

public static ControlFont getControlFont()


processing library controlP5 by Andreas Schlegel. (c) 2010