controlP5
Class Bang

java.lang.Object
  extended by controlP5.Controller
      extended by controlP5.Bang
All Implemented Interfaces:
CDrawable, ControllerInterface, ControlP5Constants

public class Bang
extends Controller

a bang controller triggers an event when pressed. A bang can only be assigned to a function in your program but not to a field like other controllers. Bang extends superclass Controller, for a full documentation follow this link, controller.

+Example
/**
 * ControlP5bang
* A bang doesnt have a value but only triggers an event that can be received by a * function named after the bang's name or parsing an event inside the controlEvent function. * By default a bang is triggered when pressed but this can be changed to 'release' * using theBang.setTriggerEvent(Bang.RELEASE).
* for implementation details see controlP5/Bang
* related examples ControlP5button
* by Andreas Schlegel 2010
* */ import controlP5.*; ControlP5 controlP5; int myColorBackground = color(0,0,0); color[] col = new color[] { color(100), color(150), color(200), color(250) }; void setup() { size(400,400); frameRate(30); controlP5 = new ControlP5(this); for(int i=0;i

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
 void addToXMLElement(ControlP5XMLElement theElement)
           
 void setTriggerEvent(int theEventID)
          by default a bang is triggered when the mouse is pressed.
 void setValue(float theValue)
          set the value of the bang controller.
 java.lang.String toString()
           
 void update()
          updates the value of the controller without having to set the value explicitly.
 void updateDisplayMode(int theMode)
           
 
Methods inherited from class controlP5.Controller
absolutePosition, add, addListener, arrayValue, behavior, captionLabel, changeValue, color, continuousUpdateEvents, controlWindow, defaultValue, disableSprite, draw, enableSprite, getAsXML, getColor, getHeight, getPickingColor, getSprite, getTab, getWidth, getWindow, hide, id, init, isBroadcast, isInside, isLock, isMousePressed, isMoveable, isUpdate, isUserInteraction, isVisible, isXMLsavable, keyEvent, label, linebreak, listenerSize, lock, max, min, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, name, parent, plugTo, plugTo, position, remove, remove, removeBehavior, removeListener, setArrayValue, setBehavior, setBroadcast, setCaptionLabel, setColor, setColorActive, setColorBackground, setColorCaptionLabel, setColorForeground, setColorLabel, setColorValue, setColorValueLabel, setDecimalPrecision, setDefaultValue, setDisplay, setDisplay, setGroup, setGroup, setHeight, setId, setImage, setImage, setImages, setImages, setLabel, setLabelVisible, setLock, setMax, setMin, setMousePressed, setMoveable, setParent, setPosition, setSize, setSize, setSprite, setTab, setTab, setUpdate, setUserInteraction, setValueLabel, setVisible, setWidth, setWindow, setWindow, show, stringValue, trigger, unlock, unplugFrom, unplugFrom, updateAbsolutePosition, updateEvents, updateInternalEvents, updateSize, value, valueLabel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

setTriggerEvent

public void setTriggerEvent(int theEventID)
by default a bang is triggered when the mouse is pressed. use setTriggerEvent(Bang.PRESSED) or setTriggerEvent(Bang.RELEASE) to define the action for triggering a bang. currently only Bang.PRESSED and Bang.RELEASE are supported.

Parameters:
theEventID -

setValue

public void setValue(float theValue)
set the value of the bang controller. since bang can be true or false, false=0 and true=1

Specified by:
setValue in class Controller
Parameters:
theValue - float

update

public void update()
Description copied from class: Controller
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
Overrides:
update in class Controller

addToXMLElement

public void addToXMLElement(ControlP5XMLElement theElement)
Parameters:
theElement - ControlP5XMLElement

updateDisplayMode

public void updateDisplayMode(int theMode)

toString

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


processing library controlP5 by Andreas Schlegel. (c) 2010