Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## controlP5
Class Controller

    java.lang.Object
      controlP5.Controller

All Implemented Interfaces:
  CDrawable, ControllerInterface, ControlP5Constants

Direct Known Subclasses:
  Bang, Button, Chart, Knob, Matrix, MultiList, Numberbox, 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 notify the main program in 2 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) `Controller.setBroadcast(boolean)`
- (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`, `RadioButton`, `ListBox`, `Slider`, `Textarea`, `Textfield`, `Textlabel`, `Toggle`, `ControlGroup`, `ControlBehavior`, `ControlEvent`
  +Example
    `

        /**
         * ControlP5 Basics
         *
         * 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, 2011
         * www.sojamo.de/libraries/controlp5
         *
         */

        import controlP5.*;

        ControlP5 cp5;
        public int myColorRect = 200;
        public int myColorBackground = 100;

        void setup() {
          size(400, 400);
          noStroke();

          cp5 = new ControlP5(this);

          // create a slider
          // parameters:
          // name, minValue, maxValue, defaultValue, x, y, width, height
          cp5.addSlider("sliderA", 100, 200, 100, 100, 260, 100, 14);

          // create 3 numberboxes and assign an id for each
          cp5.addNumberbox("numberboxA", myColorRect, 100, 140, 100, 14).setId(1);
          cp5.addNumberbox("numberboxB", myColorBackground, 100, 180, 100, 14).setId(2);
          cp5.addNumberbox("numberboxC", 0, 100, 220, 100, 14).setId(3);

          // create a texfield
          cp5.addTextfield("textA", 100, 290, 100, 20);

          // change individual settings for a controller
          cp5.getController("numberboxA").setMax(255);
          cp5.getController("numberboxA").setMin(0);
        }

        void draw() {
          background(myColorBackground);
          fill(myColorRect);
          rect(0, 0, width, 100);
        }

        // events from controller numberboxC are received here
        public void numberboxC(int theValue) {
          println("### got an event from numberboxC : "+theValue);
        }

        // an event from slider sliderA will change the value of textfield textA here
        public void sliderA(int theValue) {
          Textfield txt = ((Textfield)cp5.getController("textA"));
          txt.setValue(""+theValue);
        }

        // for every change (a textfield event confirmed with a return) in textfield textA,
        // function textA will be invoked
        public void textA(String theValue) {
          println("### got an event from textA : "+theValue);
        }

        // function controlEvent will be invoked with every value change
        // in any registered controller
        public void controlEvent(ControlEvent theEvent) {
          println("got a control event from controller with id "+theEvent.getId());
          switch(theEvent.getId()) {
            case(1): // numberboxA is registered with id 1
            myColorRect = (int)(theEvent.getController().getValue());
            break;
            case(2):  // numberboxB is registered with id 2
            myColorBackground = (int)(theEvent.getController().getValue());
            break;
          }
        }

    `

Field Summary
`static int` | `autoHeight`
`static processing.core.PVector` | `autoSpacing`
`static int` | `autoWidth`

Fields inherited from interface controlP5.ControlP5Constants
`acceptClassList, ACTION_BROADCAST, ACTION_ENTER, ACTION_LEAVE, ACTION_PRESSED, ACTION_RELEASED, ACTION_RELEASEDOUTSIDE, ACTIVE, ALL, ALT, ARC, ARRAY, BACKSPACE, BASELINE, BITFONT, BOOLEAN, BOTTOM, BOTTOM_OUTSIDE, CAPTIONLABEL, CENTER, COMMANDKEY, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DONE, DOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FADEIN, FADEOUT, FIELD, FLOAT, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IDLE, IMAGE, INACTIVE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LEFT_OUTSIDE, LINE, LOAD, MENU, METHOD, MOVE, MULTI, MULTIPLES, OVER, PI, PRESSED, PRINT, RELEASE, RESET, RIGHT, RIGHT_OUTSIDE, SAVE, SHIFT, SINGLE, SINGLE_COLUMN, SINGLE_ROW, SPRITE, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, TAB, TOP, TOP_OUTSIDE, TRANSITION_WAIT_FADEIN, TWO_PI, UP, VALUELABEL, VERBOSE, VERTICAL, WAIT`

Constructor Summary
`Controller(ControlP5 theControlP5, java.lang.String theName)` Convenience constructor to extend Controller.

Method Summary
`java.lang.Object` | `add(ControllerInterface theElement)`
`java.lang.Object` | `addCallback(CallbackListener theListener)`
`java.lang.Object` | `addListener(ControlListener theListener)`
`java.lang.Object` | `align(int theCaptionX, int theCaptionY, int theValueX, int theValueY)`
`java.lang.Object` | `bringToFront()`
`java.lang.Object` | `bringToFront(ControllerInterface theController)`
`java.lang.Object` | `changeValue(float theValue)` sets the value of the controller without sending the broadcast event.
`processing.core.PVector` | `getAbsolutePosition()`
`java.lang.String` | `getAddress()`
`float[]` | `getArrayValue()` returns the current float array value of a controller.
`float` | `getArrayValue(int theIndex)`
`ControlBehavior` | `getBehavior()`
`Label` | `getCaptionLabel()`
`CColor` | `getColor()`
`java.util.List` | `getControllerPlugList()`
`ControlWindow` | `getControlWindow()`
`int` | `getDecimalPrecision()`
`float` | `getDefaultValue()`
`int` | `getHeight()`
`int` | `getId()` returns the id of a controller, by default the id is -1.
`java.lang.String` | `getLabel()` returns the controller's caption label text.
`float` | `getMax()` returns the maximum value of the controller.
`float` | `getMin()` returns the minimum value of the controller.
`java.lang.String` | `getName()` returns the index name of the controller.
`ControllerInterface` | `getParent()` returns the parent of a controller.
`int` | `getPickingColor()`
`Pointer` | `getPointer()`
`processing.core.PVector` | `getPosition()` get the position of a controller.
`ControllerProperty` | `getProperty(java.lang.String thePropertyName)`
`ControllerProperty` | `getProperty(java.lang.String theSetter, java.lang.String theGetter)`
`java.lang.String` | `getStringValue()`
`Tab` | `getTab()` get the instance of the tab the controller belongs to.
`float` | `getValue()`
`Label` | `getValueLabel()`
`int` | `getWidth()`
`ControlWindow` | `getWindow()` returns the control window of the controller
`java.lang.Object` | `hide()`
`void` | `init()`
`boolean` | `isActive()` checks if a controller is active.
`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` | `isLabelVisible()`
`boolean` | `isListening()` returns true or false for the current listening status.
`boolean` | `isLock()`
`boolean` | `isMouseOver()` check if the mouse is within this particular controller.
`boolean` | `isMousePressed()` returns true or false if the mouse has is pressed.
`boolean` | `isMoveable()` checks if a controller is moveable.
`boolean` | `isUpdate()` enables the update function for a controller.
`boolean` | `isVisible()`
`void` | `keyEvent(java.awt.event.KeyEvent theEvent)`
`java.lang.Object` | `linebreak()`
`java.lang.Object` | `listen(boolean theValue)` enables a controller to listen to changes made to the variable linked to the controller.
`int` | `listenerSize()`
`java.lang.Object` | `lock()` disables the controller to be moved, or changed or controlled by the user.
`java.lang.Object` | `moveTo(ControlGroup theGroup)`
`java.lang.Object` | `moveTo(ControllerGroup theGroup)`
`java.lang.Object` | `moveTo(ControllerGroup theGroup, Tab theTab, ControlWindow theControlWindow)`
`java.lang.Object` | `moveTo(ControlWindow theControlWindow)` moves the controller to the default tab of a control window - other than the main window.
`java.lang.Object` | `moveTo(ControlWindow theControlWindow, java.lang.String theTabName)`
`java.lang.Object` | `moveTo(processing.core.PApplet theApplet)` moves the controller to the default tab inside the main window.
`java.lang.Object` | `moveTo(processing.core.PApplet theApplet, java.lang.String theTabName)` moves the controller to a tab inside the main window.
`java.lang.Object` | `moveTo(java.lang.String theTabName)` moves the controller to another tab.
`java.lang.Object` | `moveTo(Tab theTab)` moves the controller to another tab.
`java.lang.Object` | `plugTo(java.lang.Object theObject)`
`java.lang.Object` | `plugTo(java.lang.Object[] theObjects)` plugs the controller to a list of objects
`java.lang.Object` | `plugTo(java.lang.Object[] theObjects, java.lang.String theName)`
`java.lang.Object` | `plugTo(java.lang.Object theObject, java.lang.String theName)`
`java.lang.Object` | `registerProperty(java.lang.String thePropertyName)`
`java.lang.Object` | `registerProperty(java.lang.String theSetter, java.lang.String theGetter)`
`java.lang.Object` | `registerTooltip(java.lang.String theText)` adds a tooltip to a controller, by default the tooltip is disabled.
`void` | `remove()` removes a controller from controlP5.
`java.lang.Object` | `remove(ControllerInterface theElement)`
`java.lang.Object` | `removeBehavior()`
`java.lang.Object` | `removeCallback()`
`java.lang.Object` | `removeCallback(CallbackListener theListener)`
`java.lang.Object` | `removeListener(ControlListener theListener)`
`java.lang.Object` | `removeProperty(java.lang.String thePropertyName)`
`java.lang.Object` | `removeProperty(java.lang.String theSetter, java.lang.String theGetter)`
`java.lang.Object` | `setAbsolutePosition(processing.core.PVector thePVector)`
`java.lang.Object` | `setAddress(java.lang.String theAddress)`
`java.lang.Object` | `setArrayValue(float[] theArray)`
`java.lang.Object` | `setArrayValue(int theIndex, float theValue)`
`java.lang.Object` | `setBehavior(ControlBehavior theBehavior)` with setBehavior you can add a ControlBehavior to a controller.
`java.lang.Object` | `setBroadcast(boolean theFlag)` Use setBroadcast to enable and disable the broadcasting of changes in a controller's value.
`java.lang.Object` | `setCaptionLabel(java.lang.String theLabel)` sets the content of the caption label of a controller.
`java.lang.Object` | `setColor(CColor theColor)`
`java.lang.Object` | `setColorActive(int theColor)`
`java.lang.Object` | `setColorBackground(int theColor)`
`java.lang.Object` | `setColorCaptionLabel(int theColor)`
`java.lang.Object` | `setColorForeground(int theColor)`
`java.lang.Object` | `setColorValueLabel(int theColor)`
`java.lang.Object` | `setDecimalPrecision(int theValue)` sets the decimal precision of a controller's float value displayed.
`java.lang.Object` | `setDefaultValue(float theValue)` set the default value.
`java.lang.Object` | `setGroup(ControllerGroup theGroup)`
`java.lang.Object` | `setGroup(java.lang.String theName)` sets the group of the controller.
`java.lang.Object` | `setHeight(int theHeight)`
`java.lang.Object` | `setId(int theId)` set the id of a controller.
`java.lang.Object` | `setImage(processing.core.PImage theImage)`
`java.lang.Object` | `setImage(processing.core.PImage theImage, int theState)`
`java.lang.Object` | `setImages(processing.core.PImage[] imgs)`
`java.lang.Object` | `setImages(processing.core.PImage theImageDefault, processing.core.PImage theImageOver, processing.core.PImage theImageActive)` by default controllers use simple shapes, to replace these shapes with images, use setImages().
`java.lang.Object` | `setImages(processing.core.PImage theImageDefault, processing.core.PImage theImageOver, processing.core.PImage theImageActive, processing.core.PImage theImageHighlight)`
`java.lang.Object` | `setLabelVisible(boolean theValue)` show or hide the labels of a controller.
`java.lang.Object` | `setLock(boolean theValue)` sets the lock status of the controller
`java.lang.Object` | `setMax(float theValue)` sets the maximum value of the Controller.
`java.lang.Object` | `setMin(float theValue)` sets the minimum value of the Controller.
`java.lang.Object` | `setMouseOver(boolean theFlag)`
`boolean` | `setMousePressed(boolean theStatus)`
`java.lang.Object` | `setMoveable(boolean theValue)` enable or prevent the controller to be moveable.
`java.lang.Object` | `setParent(ControllerInterface theParent)` set the parent of a parent of a controller.
`java.lang.Object` | `setPosition(float theX, float theY)` set the position of a controller.
`java.lang.Object` | `setPosition(processing.core.PVector thePVector)`
`java.lang.Object` | `setSize(int theWidth, int theHeight)`
`java.lang.Object` | `setSize(processing.core.PImage theImage)` auto-updates the size of a controller according to the dimensions of the PImage.
`java.lang.Object` | `setStringValue(java.lang.String theValue)`
`java.lang.Object` | `setTab(ControlWindow theWindow, java.lang.String theName)`
`java.lang.Object` | `setTab(java.lang.String theName)` sets the tab of the controller.
`java.lang.Object` | `setUpdate(boolean theFlag)` disables the update function for a controller.
`java.lang.Object` | `setValue(float theValue)`
`java.lang.Object` | `setValueLabel(java.lang.String theLabel)` set or change the value of the value label of a controller.
`java.lang.Object` | `setView(ControllerView theDisplay)` use setDisplay to customize your controller look.
`void` | `setView(ControllerView theDisplay, int theMode)`
`java.lang.Object` | `setVisible(boolean theFlag)`
`java.lang.Object` | `setWidth(int theWidth)`
`java.lang.Object` | `show()`
`java.lang.Object` | `unlock()` enables the controller to be moved, changed and controlled by the user.
`java.lang.Object` | `unplugFrom(java.lang.Object theObject)` unplugs the Controller for a single object
`java.lang.Object` | `unplugFrom(java.lang.Object[] theObjects)` unplugs the controller from a list of objects
`java.lang.Object` | `unregisterTooltip()`
`java.lang.Object` | `update()` updates the value of the controller without having to set the value explicitly.
`java.lang.Object` | `updateAbsolutePosition()`
`java.lang.Object` | `updateEvents()` updateEvents is used for internal updates of a controller.
`java.lang.Object` | `updateInternalEvents(processing.core.PApplet theApplet)` a method for putting input events like e.g.
`java.lang.Object` | `updateSize()`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface controlP5.ControllerInterface
`continuousUpdateEvents, draw, parent, setColorLabel, setColorValue, setLabel`

Methods inherited from interface controlP5.CDrawable
`draw`

Field Detail

### autoHeight

    public static int autoHeight

### autoSpacing

    public static processing.core.PVector autoSpacing

### autoWidth

    public static int autoWidth

Constructor Detail

### Controller

    public Controller(ControlP5 theControlP5,
                      java.lang.String theName)

  Convenience constructor to extend Controller.

  Parameters:
    `theControlP5` -
    `theName` -
    +Example
      `

          /**
           * ControlP5 extending Controllers
           *
           * the following example shows how to extend the Controller class to
           * create customizable Controllers. You can either extend the Controller class itself,
           * or any class that extends Controller itself like the Slider, Button, DropdownList, etc.
           *
           * How to:
           *
           * 1) do a super call to the convenience constructor requiring
           * 2 parameter (ControlP5 instance, name)
           *
           * 2) the Controller class has a set of empty methods that allow you to capture
           * inputs from the mouse including
           * onEnter(), onLeave(), onPress(), onRelease(), onClick(), onScroll(int), onDrag()
           * These you can override and include functionality as needed.
           *
           * 3) use method getPointer() to return the local (relative)
           * xy-coordinates of the controller
           *
           * 4) after instantiation custom controllers are treated the same
           * as default controlP5 controllers.
           *
           * by Andreas Schlegel, 2012
           * www.sojamo.de/libraries/controlp5
           *
           */

          import controlP5.*;

          ControlP5 cp5;
          PApplet p;

          void setup() {
            size(400, 400);
            cp5 = new ControlP5(this);

            // create 2 groups to show nesting of custom controllers and
            //
            Group g1 = cp5.addGroup("a").setPosition(0,100).setWidth(180);
            Group g2 = cp5.addGroup("b").setPosition(0,10).setWidth(180);
            g2.moveTo(g1);

            // create 2 custom Controllers from class MyButton
            // MyButton extends Controller and inherits all methods accordingly.
            new MyButton(cp5, "b1").setPosition(0, 0).setSize(180, 200).moveTo(g2);
            new MyButton(cp5, "b2").setPosition(205, 15).setSize(180, 200);

          }

          void draw() {
            background(0);
          }

          // b1 will be called from Controller b1
          public void b1(float theValue) {
            println("yay button "+theValue);
          }

          public void controlEvent(ControlEvent theEvent) {
            println("controlEvent : "+theEvent);
          }

          // Create a custom Controller, please not that
          // MyButton extends Controller,
          // is an indicator for the super class about the type of
          // custom controller to be created.

          class MyButton extends Controller {

            int current = 0xffff0000;

            float a = 128;

            float na;

            int y;

            // use the convenience constructor of super class Controller
            // MyButton will automatically registered and move to the
            // default controlP5 tab.

            MyButton(ControlP5 cp5, String theName) {
              super(cp5, theName);

              // replace the default view with a custom view.
              setView(new ControllerView() {
                public void display(PApplet p, Object b) {
                  // draw button background
                  na += (a-na) * 0.1;
                  p.fill(current,na);
                  p.rect(0, 0, getWidth(), getHeight());

                  // draw horizontal line which can be moved on the x-axis
                  // using the scroll wheel.
                  p.fill(0,255,0);
                  p.rect(0,y,width,10);

                  // draw the custom label
                  p.fill(128);
                  translate(0,getHeight()+14);
                  p.text(getName(),0,0);
                  p.text(getName(),0,0);

                }
              }
              );
            }

            // override various input methods for mouse input control
            void onEnter() {
              cursor(HAND);
              println("enter");
              a = 255;
            }

            void onScroll(int n) {
              println("scrolling");
              y -= n;
              y = constrain(y,0,getHeight()-10);
            }

            void onPress() {
              println("press");
              current = 0xffffff00;
            }

            void onClick() {
              Pointer p1 = getPointer();
              println("clicked at "+p1.x()+", "+p1.y());
              current = 0xffffff00;
              setValue(y);
            }

            void onRelease() {
              println("release");
              current = 0xffffffff;
            }

            void onMove() {
              println("moving "+this+" "+_myControlWindow.getMouseOverList());
            }

            void onDrag() {
              current = 0xff0000ff;
              Pointer p1 = getPointer();
              float dif = dist(p1.px(),p1.py(),p1.x(),p1.y());
              println("dragging at "+p1.x()+", "+p1.y()+" "+dif);
            }

            void onReleaseOutside() {
              onLeave();
            }

            void onLeave() {
              println("leave");
              cursor(ARROW);
              a = 128;
            }
          }

      `

Method Detail

### add

    public java.lang.Object add(ControllerInterface theElement)

  Specified by:
    `add` in interface `ControllerInterface`
  Parameters:
    `theElement` - ControllerInterface
  Returns:
    Controller

### addCallback

    public java.lang.Object addCallback(CallbackListener theListener)

  Parameters:
    `theListener` -
  Returns:
    Controller
  See Also:
    `CallbackListener`

### addListener

    public java.lang.Object addListener(ControlListener theListener)

  Specified by:
    `addListener` in interface `ControllerInterface`
  Parameters:
    `theListener` - ControlListener
  Returns:
    Controller
  See Also:
    `ControlListener`

### align

    public java.lang.Object align(int theCaptionX,
                                  int theCaptionY,
                                  int theValueX,
                                  int theValueY)

### bringToFront

    public java.lang.Object bringToFront()

  Specified by:
    `bringToFront` in interface `ControllerInterface`

### bringToFront

    public java.lang.Object bringToFront(ControllerInterface theController)

  Specified by:
    `bringToFront` in interface `ControllerInterface`

### changeValue

    public final java.lang.Object changeValue(float theValue)

  sets the value of the controller without sending the broadcast event. this function is final.

  Parameters:
    `theValue` - float
  Returns:
    Controller

### getAbsolutePosition

    public processing.core.PVector getAbsolutePosition()

  Specified by:
    `getAbsolutePosition` in interface `ControllerInterface`
  Returns:
    `PVector`

### getAddress

    public java.lang.String getAddress()

  Specified by:
    `getAddress` in interface `ControllerInterface`

### getArrayValue

    public float[] getArrayValue()

  returns the current float array value of a controller.

  Specified by:
    `getArrayValue` in interface `ControllerInterface`
  Returns:
    float[]
  See Also:
    `Controller.getValue()`, `Controller.getStringValue()`

### getArrayValue

    public float getArrayValue(int theIndex)

  Specified by:
    `getArrayValue` in interface `ControllerInterface`
  Parameters:
    `theIndex` -
  Returns:
    float

### getBehavior

    public ControlBehavior getBehavior()

  Returns:
    ControlBehavior

### getCaptionLabel

    public Label getCaptionLabel()

  Returns:
    Label
  See Also:
    `Label`

### getColor

    public CColor getColor()

  Specified by:
    `getColor` in interface `ControllerInterface`

### getControllerPlugList

    public java.util.List getControllerPlugList()

  Returns:
    List

### getControlWindow

    public ControlWindow getControlWindow()

  Returns:
    ControlWindow

### getDecimalPrecision

    public int getDecimalPrecision()

  Returns:
    int

### getDefaultValue

    public float getDefaultValue()

  Returns:
    float

### getHeight

    public int getHeight()

  Specified by:
    `getHeight` in interface `ControllerInterface`
  Returns:
    int

### getId

    public int getId()

  returns the id of a controller, by default the id is -1. Any int can be given to a controller as its ID, controlP5 does not recognize duplicates, this has to be managed on the user site.

  Specified by:
    `getId` in interface `ControllerInterface`
  Returns:
    int

### getLabel

    public java.lang.String getLabel()

  returns the controller's caption label text.

  Returns:
    String

### getMax

    public float getMax()

  returns the maximum value of the controller.

  Returns:
    float

### getMin

    public float getMin()

  returns the minimum value of the controller.

  Returns:
    float

### getName

    public java.lang.String getName()

  returns the index name of the controller.

  Specified by:
    `getName` in interface `ControllerInterface`
  Returns:
    String

### getParent

    public ControllerInterface getParent()

  returns the parent of a controller.

  Specified by:
    `getParent` in interface `ControllerInterface`
  Returns:
    ControllerInterface

### getPickingColor

    public int getPickingColor()

  Specified by:
    `getPickingColor` in interface `ControllerInterface`

### getPointer

    public final Pointer getPointer()

### getPosition

    public processing.core.PVector getPosition()

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

  Specified by:
    `getPosition` in interface `ControllerInterface`

### getProperty

    public ControllerProperty getProperty(java.lang.String thePropertyName)

  Specified by:
    `getProperty` in interface `ControllerInterface`

### getProperty

    public ControllerProperty getProperty(java.lang.String theSetter,
                                          java.lang.String theGetter)

  Specified by:
    `getProperty` in interface `ControllerInterface`

### getStringValue

    public java.lang.String getStringValue()

  Specified by:
    `getStringValue` in interface `ControllerInterface`
  Returns:
    String
  See Also:
    `Controller.getValue()`, `Controller.getArrayValue()`

### getTab

    public Tab getTab()

  get the instance of the tab the controller belongs to.

  Specified by:
    `getTab` in interface `ControllerInterface`
  Returns:
    Tab

### getValue

    public float getValue()

  Specified by:
    `getValue` in interface `ControllerInterface`
  Returns:
    float
  See Also:
    `Controller.getStringValue()`, `Controller.getArrayValue()`

### getValueLabel

    public Label getValueLabel()

  Returns:
    Label

### getWidth

    public int getWidth()

  Specified by:
    `getWidth` in interface `ControllerInterface`
  Returns:
    int

### getWindow

    public ControlWindow getWindow()

  returns the control window of the controller

  Specified by:
    `getWindow` in interface `ControllerInterface`
  Returns:
    ControlWindow

### hide

    public java.lang.Object hide()

  Specified by:
    `hide` in interface `ControllerInterface`
  Returns:
    Controller

### init

    public void init()

  Specified by:
    `init` in interface `ControllerInterface`

### isActive

    public boolean isActive()

  checks if a controller is active.

  Returns:
    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

### isInside

    public boolean isInside()

  returns true or false and indicates if the mouse is inside the area of a controller.

  Returns:
    boolean

### isLabelVisible

    public boolean isLabelVisible()

  Returns:
    boolean

### isListening

    public boolean isListening()

  returns true or false for the current listening status. by default it is set to false

  Returns:
    boolean
  See Also:
    `Controller.listen(boolean)`

### isLock

    public boolean isLock()

  Returns:
    boolean

### isMouseOver

    public boolean isMouseOver()

  check if the mouse is within this particular controller.

  Specified by:
    `isMouseOver` in interface `ControllerInterface`
  Returns:
    boolean

### isMousePressed

    public boolean isMousePressed()

  returns true or false if the mouse has is pressed.

  Returns:
    boolean

### isMoveable

    public boolean isMoveable()

  checks if a controller is moveable.

  Returns:
    boolean

### isUpdate

    public boolean isUpdate()

  enables the update function for a controller.

  Specified by:
    `isUpdate` in interface `ControllerInterface`
  Returns:
    boolean
  See Also:
    `Controller.update()`, `Controller.setUpdate(boolean)`

### isVisible

    public boolean isVisible()

  Specified by:
    `isVisible` in interface `ControllerInterface`
  Returns:
    boolean

### keyEvent

    public void keyEvent(java.awt.event.KeyEvent theEvent)

  Specified by:
    `keyEvent` in interface `ControllerInterface`
  Parameters:
    `KeyEvent` - theEvent

### linebreak

    public java.lang.Object linebreak()

  Returns:
    Controller

### listen

    public java.lang.Object listen(boolean theValue)

  enables a controller to listen to changes made to the variable linked to the controller. Use true to enable and false to disable a controller from listening to changes.

  Parameters:
    `theFlag` -
  Returns:
    Controller

### listenerSize

    public int listenerSize()

  Returns:
    int

### lock

    public java.lang.Object lock()

  disables the controller to be moved, or changed or controlled by the user.

  Returns:
    Controller

### moveTo

    public final java.lang.Object moveTo(ControlGroup theGroup)

  Parameters:
    `theGroup` -
  Returns:
    Controller

### moveTo

    public final java.lang.Object moveTo(ControllerGroup theGroup)

  Specified by:
    `moveTo` in interface `ControllerInterface`

### moveTo

    public final java.lang.Object moveTo(ControllerGroup theGroup,
                                         Tab theTab,
                                         ControlWindow theControlWindow)

  Specified by:
    `moveTo` in interface `ControllerInterface`

### moveTo

    public final java.lang.Object moveTo(ControlWindow theControlWindow)

  moves the controller to the default tab of a control window - other than the main window.

  Parameters:
    `theControlWindow` -

### moveTo

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

  Parameters:
    `theControlWindow` -
    `theTabName` -
  Returns:
    Controller

### moveTo

    public final java.lang.Object moveTo(processing.core.PApplet theApplet)

  moves the controller to the default tab inside the main window.

  Parameters:
    `theApplet` -
  Returns:
    Controller

### moveTo

    public final java.lang.Object moveTo(processing.core.PApplet theApplet,
                                         java.lang.String theTabName)

  moves the controller to a tab inside the main window.

  Parameters:
    `theApplet` -
    `theTabName` -

### moveTo

    public final java.lang.Object moveTo(java.lang.String theTabName)

  moves the controller to another tab. The tab is defined by parameter theTabName. if controlP5 can't find a tab with given name, controlP5 will create this tab and add it to the main window.

  Parameters:
    `theTabName` - String
  Returns:
    Controller

### moveTo

    public final java.lang.Object moveTo(Tab theTab)

  moves the controller to another tab.

  Parameters:
    `theTab` -
  Returns:
    Controller

### plugTo

    public java.lang.Object plugTo(java.lang.Object theObject)

  Parameters:
    `theObject` -
  Returns:
    Controller

### plugTo

    public java.lang.Object plugTo(java.lang.Object[] theObjects)

  plugs the controller to a list of objects

  Parameters:
    `theObject` -
  Returns:
    Controller

### plugTo

    public java.lang.Object plugTo(java.lang.Object[] theObjects,
                                   java.lang.String theName)

  Parameters:
    `theObjects` -
    `theName` -
  Returns:
    Controller

### plugTo

    public java.lang.Object plugTo(java.lang.Object theObject,
                                   java.lang.String theName)

### registerProperty

    public java.lang.Object registerProperty(java.lang.String thePropertyName)

  Specified by:
    `registerProperty` in interface `ControllerInterface`

### registerProperty

    public java.lang.Object registerProperty(java.lang.String theSetter,
                                             java.lang.String theGetter)

  Specified by:
    `registerProperty` in interface `ControllerInterface`

### registerTooltip

    public java.lang.Object registerTooltip(java.lang.String theText)

  adds a tooltip to a controller, by default the tooltip is disabled. A Tooltip is made visible when entering a controller with the mouse, when the mouse is moved inside the controller, the tooltip will hide.

  Parameters:
    `theText` -
  Returns:
    Controller

### remove

    public void remove()

  removes a controller from controlP5.

  Specified by:
    `remove` in interface `ControllerInterface`

### remove

    public java.lang.Object remove(ControllerInterface theElement)

  Specified by:
    `remove` in interface `ControllerInterface`
  Parameters:
    `theElement` - ControllerInterface
  Returns:
    Controller

### removeBehavior

    public java.lang.Object removeBehavior()

  Returns:
    Controller

### removeCallback

    public java.lang.Object removeCallback()

  Returns:
    Controller

### removeCallback

    public java.lang.Object removeCallback(CallbackListener theListener)

  Parameters:
    `theListener` -
  Returns:
    Controller
  See Also:
    `CallbackListener`

### removeListener

    public java.lang.Object removeListener(ControlListener theListener)

  Parameters:
    `theListener` - ControlListener
  Returns:
    Controller
  See Also:
    `ControlListener`

### removeProperty

    public java.lang.Object removeProperty(java.lang.String thePropertyName)

  Specified by:
    `removeProperty` in interface `ControllerInterface`

### removeProperty

    public java.lang.Object removeProperty(java.lang.String theSetter,
                                           java.lang.String theGetter)

  Specified by:
    `removeProperty` in interface `ControllerInterface`

### setAbsolutePosition

    public java.lang.Object setAbsolutePosition(processing.core.PVector thePVector)

  Specified by:
    `setAbsolutePosition` in interface `ControllerInterface`

### setAddress

    public java.lang.Object setAddress(java.lang.String theAddress)

  Specified by:
    `setAddress` in interface `ControllerInterface`

### setArrayValue

    public java.lang.Object setArrayValue(float[] theArray)

  Specified by:
    `setArrayValue` in interface `ControllerInterface`
  Parameters:
    `theArray` -
  Returns:
    Controller

### setArrayValue

    public java.lang.Object setArrayValue(int theIndex,
                                          float theValue)

  Specified by:
    `setArrayValue` in interface `ControllerInterface`
  Parameters:
    `theIndex` -
    `theValue` -
  Returns:
    Controller

### setBehavior

    public java.lang.Object 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
  Returns:
    Controller

### setBroadcast

    public java.lang.Object 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
  Returns:
    Controller

### setCaptionLabel

    public java.lang.Object setCaptionLabel(java.lang.String theLabel)

  sets the content of the caption label of a controller.

  Specified by:
    `setCaptionLabel` in interface `ControllerInterface`
  Parameters:
    `theLabel` -
  Returns:
    Controller

### setColor

    public java.lang.Object setColor(CColor theColor)

  Specified by:
    `setColor` in interface `ControllerInterface`

### setColorActive

    public java.lang.Object setColorActive(int theColor)

  Specified by:
    `setColorActive` in interface `ControllerInterface`

### setColorBackground

    public java.lang.Object setColorBackground(int theColor)

  Specified by:
    `setColorBackground` in interface `ControllerInterface`

### setColorCaptionLabel

    public java.lang.Object setColorCaptionLabel(int theColor)

  Parameters:
    `theColor` -
  Returns:
    Controller

### setColorForeground

    public java.lang.Object setColorForeground(int theColor)

  Specified by:
    `setColorForeground` in interface `ControllerInterface`

### setColorValueLabel

    public java.lang.Object setColorValueLabel(int theColor)

  Parameters:
    `theColor` -
  Returns:
    Controller

### setDecimalPrecision

    public java.lang.Object 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` -
  Returns:
    Controller

### setDefaultValue

    public java.lang.Object setDefaultValue(float theValue)

  set the default value.

  Parameters:
    `theValue` - float
  Returns:
    Controller

### setGroup

    public final java.lang.Object setGroup(ControllerGroup theGroup)

### setGroup

    public final java.lang.Object setGroup(java.lang.String theName)

  sets the group of the controller.

  Parameters:
    `theName` - String
  Returns:
    Controller

### setHeight

    public java.lang.Object setHeight(int theHeight)

  Parameters:
    `theHeight` -
  Returns:
    Controller

### setId

    public java.lang.Object setId(int theId)

  set the id of a controller.

  Specified by:
    `setId` in interface `ControllerInterface`
  Parameters:
    `int` - theId
  Returns:
    Controller

### setImage

    public java.lang.Object setImage(processing.core.PImage theImage)

### setImage

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

  Parameters:
    `theImage` -
    `theState` - use Controller.DEFAULT (background) Controller.OVER (foreground) Controller.ACTIVE (active)

### setImages

    public java.lang.Object setImages(processing.core.PImage[] imgs)

### setImages

    public java.lang.Object setImages(processing.core.PImage theImageDefault,
                                      processing.core.PImage theImageOver,
                                      processing.core.PImage theImageActive)

  by default controllers use simple shapes, to replace these shapes with images, use setImages(). This can be handy for buttons, toggles, bangs, for more complex controllers such as sliders, range, dropdownlist this is not advisable.

  Parameters:
    `theImageDefault` -
    `theImageOver` -
    `theImageActive` -
  Returns:
    Controller

### setImages

    public java.lang.Object setImages(processing.core.PImage theImageDefault,
                                      processing.core.PImage theImageOver,
                                      processing.core.PImage theImageActive,
                                      processing.core.PImage theImageHighlight)

### setLabelVisible

    public java.lang.Object setLabelVisible(boolean theValue)

  show or hide the labels of a controller.

  Parameters:
    `theValue` - boolean
  Returns:
    Controller

### setLock

    public java.lang.Object setLock(boolean theValue)

  sets the lock status of the controller

  Parameters:
    `theValue` -
  Returns:
    Controller

### setMax

    public java.lang.Object setMax(float theValue)

  sets the maximum value of the Controller.

  Parameters:
    `theValue` - float
  Returns:
    Controller

### setMin

    public java.lang.Object setMin(float theValue)

  sets the minimum value of the Controller.

  Parameters:
    `theValue` - float
  Returns:
    Controller

### setMouseOver

    public java.lang.Object setMouseOver(boolean theFlag)

  Specified by:
    `setMouseOver` in interface `ControllerInterface`

### setMousePressed

    public final boolean setMousePressed(boolean theStatus)

  Specified by:
    `setMousePressed` in interface `ControllerInterface`
  Parameters:
    `theStatus` - boolean
  Returns:
    boolean

### setMoveable

    public java.lang.Object setMoveable(boolean theValue)

  enable or prevent the controller to be moveable. By default a controller is moveable.

  Parameters:
    `theValue` - boolean
  Returns:
    Controller

### setParent

    public final java.lang.Object 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
  Returns:
    Controller

### setPosition

    public java.lang.Object 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
  Returns:
    Controller

### setPosition

    public java.lang.Object setPosition(processing.core.PVector thePVector)

  Specified by:
    `setPosition` in interface `ControllerInterface`

### setSize

    public java.lang.Object setSize(int theWidth,
                                    int theHeight)

  Parameters:
    `theWidth` -
    `theHeight` -
  Returns:
    Controller

### setSize

    public java.lang.Object setSize(processing.core.PImage theImage)

  auto-updates the size of a controller according to the dimensions of the PImage.

  Parameters:
    `theImage` -
  Returns:
    Controller

### setStringValue

    public java.lang.Object setStringValue(java.lang.String theValue)

  Specified by:
    `setStringValue` in interface `ControllerInterface`
  Parameters:
    `theValue` -
  Returns:
    Controller

### setTab

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

### setTab

    public final java.lang.Object setTab(java.lang.String theName)

  sets the tab of the controller.

  Parameters:
    `theName` - String
  Returns:
    Controller

### setUpdate

    public java.lang.Object setUpdate(boolean theFlag)

  disables the update function for a controller.

  Specified by:
    `setUpdate` in interface `ControllerInterface`
  Parameters:
    `theFlag` - boolean
  Returns:
    Controller
  See Also:
    `Controller.update()`, `Controller.isUpdate()`

### setValue

    public java.lang.Object setValue(float theValue)

  Specified by:
    `setValue` in interface `ControllerInterface`
  Parameters:
    `theValue` - float

### setValueLabel

    public java.lang.Object 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` -
  Returns:
    Controller

### setView

    public java.lang.Object setView(ControllerView theDisplay)

  use setDisplay to customize your controller look. A new controller-display class required to implement interface ControllerView. By default the display mode will be set to CUSTOM when setting a new display.

  Parameters:
    `theDisplay` -
  Returns:
    Controller
  See Also:
    `ControllerView`

### setView

    public void setView(ControllerView theDisplay,
                        int theMode)

### setVisible

    public java.lang.Object setVisible(boolean theFlag)

  Parameters:
    `theFlag` - boolean
  Returns:
    Controller

### setWidth

    public java.lang.Object setWidth(int theWidth)

  Parameters:
    `theWidth` -
  Returns:
    Controller

### show

    public java.lang.Object show()

  Specified by:
    `show` in interface `ControllerInterface`
  Returns:
    Controller

### unlock

    public java.lang.Object unlock()

  enables the controller to be moved, changed and controlled by the user.

  Returns:
    Controller

### unplugFrom

    public java.lang.Object unplugFrom(java.lang.Object theObject)

  unplugs the Controller for a single object

  Parameters:
    `theObject` -
  Returns:
    Controller

### unplugFrom

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

  unplugs the controller from a list of objects

  Parameters:
    `theObjects` -
  Returns:

### unregisterTooltip

    public java.lang.Object unregisterTooltip()

  Returns:
    Controller
  See Also:
    `Controller.registerTooltip(String)`

### update

    public java.lang.Object 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().

  Specified by:
    `update` in interface `ControllerInterface`
  Returns:
    Controller
  See Also:
    `Controller.setUpdate(boolean)`, `Controller.isUpdate()`

### updateAbsolutePosition

    public java.lang.Object updateAbsolutePosition()

  Specified by:
    `updateAbsolutePosition` in interface `ControllerInterface`

### updateEvents

    public final java.lang.Object 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 java.lang.Object updateInternalEvents(processing.core.PApplet theApplet)

  Description copied from interface: `ControllerInterface`
  a method for putting input events like e.g. mouse or keyboard events and queries. this has been taken out of the draw method for better overwriting capability.

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

### updateSize

    public java.lang.Object updateSize()

Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

processing library controlP5 by Andreas Schlegel. (c) 2006-2012