controlP5
Class Tab

java.lang.Object
  extended by controlP5.ControllerGroup
      extended by controlP5.Tab
All Implemented Interfaces:
ControllerInterface, ControlP5Constants

public class Tab
extends ControllerGroup

Tab extends ControllerGroup, for more available methods see the ControllerGroup documentation.

+Example
/**
  * ControlP5 Tab.
  *
  * by andreas schlegel, 2009
  */

import controlP5.*;


ControlP5 controlP5;

int myColorBackground = color(0,0,0);

int sliderValue = 100;

void setup() {
  size(400,400);
  frameRate(30);
  controlP5 = new ControlP5(this);
  controlP5.addButton("button",10,100,80,80,20);
  controlP5.addButton("buttonValue",4,100,110,80,20);
  controlP5.addSlider("sliderValue",0,255,128,100,200,10,100);
  controlP5.addSlider("slider",100,200,128,100,160,100,10);
  // tab global is a tab that lies on top of any other tab and
  // is always visible
  controlP5.controller("slider").moveTo("global");
  
  controlP5.controller("sliderValue").moveTo("extra");
  controlP5.tab("extra").setColorForeground(0xffff0000);
  controlP5.tab("extra").setColorBackground(0xff330000);
  
  controlP5.trigger();
  
  // in case you want to receive a controlEvent when
  // a  tab is clicked, use activeEvent(true)
  controlP5.tab("extra").activateEvent(true);
  controlP5.tab("extra").setId(2);
  
  controlP5.tab("default").activateEvent(true);
  // to rename the label of a tab, use setLabe("..."),
  // the name of the tab will remain as given when initialized.
  controlP5.tab("default").setLabel("something");
  controlP5.tab("default").setId(1);
}

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

void slider(int theColor) {
  myColorBackground = color(theColor);
  println("a slider event. setting background to "+theColor);
}

void controlEvent(ControlEvent theControlEvent) {
  if(theControlEvent.isController()) {
    println("controller : "+theControlEvent.controller().id());
  } else if (theControlEvent.isTab()) {
    println("tab : "+theControlEvent.tab().id()+" / "+theControlEvent.tab().name());
  }
}

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
 
Constructor Summary
Tab(ControlP5 theControlP5, ControlWindow theControlWindow, java.lang.String theName)
           
 
Method Summary
 Tab activateEvent(boolean theFlag)
          activate or deactivate the Event status of a tab.
 void addToXMLElement(ControlP5XMLElement theElement)
           
 void mousePressed()
           
 void moveTo(ControlWindow theWindow)
           
 void setActive(boolean theFlag)
           
 Tab setHeight(int theHeight)
           
 void setLabel(java.lang.String theLabel)
          set the label of the group.
 void setStringValue(java.lang.String theValue)
          set the string value of the tab.
 void setValue(float theValue)
          set the value of the tab.
 Tab setWidth(int theWidth)
           
 java.lang.String stringValue()
          get the string value of the tab.
 float value()
          get the value of the tab.
 
Methods inherited from class controlP5.ControllerGroup
absolutePosition, add, addCanvas, addDrawable, arrayValue, captionLabel, close, color, continuousUpdateEvents, controller, disableCollapse, draw, enableCollapse, getAsXML, getColor, getHeight, getPickingColor, getTab, getWidth, getWindow, hide, id, init, isCollapse, isMoveable, isOpen, isUpdate, isVisible, isXMLsavable, keyEvent, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, name, open, parent, position, remove, remove, remove, removeCanvas, setColorActive, setColorBackground, setColorForeground, setColorLabel, setColorValue, setGroup, setGroup, setId, setMousePressed, setMoveable, setOpen, setPosition, setTab, setTab, setTab, setUpdate, setVisible, show, toString, update, updateAbsolutePosition, updateEvents, updateInternalEvents, valueLabel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Tab

public Tab(ControlP5 theControlP5,
           ControlWindow theControlWindow,
           java.lang.String theName)
Parameters:
theControlP5 - ControlP5
theControlWindow - ControlWindow
theName - String
Method Detail

setLabel

public void setLabel(java.lang.String theLabel)
set the label of the group. TODO overwriting COntrollerGroup.setLabel to set the Width of a tab after renaming. this should be temporary and fixed in the future.

Specified by:
setLabel in interface ControllerInterface
Overrides:
setLabel in class ControllerGroup
Parameters:
theLabel - String

setWidth

public Tab setWidth(int theWidth)
Overrides:
setWidth in class ControllerGroup
Parameters:
theWidth -
Returns:

setHeight

public Tab setHeight(int theHeight)
Overrides:
setHeight in class ControllerGroup

mousePressed

public void mousePressed()

setActive

public void setActive(boolean theFlag)
Parameters:
theFlag - boolean

moveTo

public void moveTo(ControlWindow theWindow)
Overrides:
moveTo in class ControllerGroup

activateEvent

public Tab activateEvent(boolean theFlag)
activate or deactivate the Event status of a tab.

Parameters:
theFlag - boolean

addToXMLElement

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

stringValue

public java.lang.String stringValue()
get the string value of the tab.

Specified by:
stringValue in interface ControllerInterface
Overrides:
stringValue in class ControllerGroup
Returns:
String

value

public float value()
get the value of the tab.

Specified by:
value in interface ControllerInterface
Overrides:
value in class ControllerGroup
Returns:
float

setValue

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

Parameters:
theValue - float

setStringValue

public void setStringValue(java.lang.String theValue)
set the string value of the tab.

Parameters:
theValue - String


processing library controlP5 by Andreas Schlegel. (c) 2010