|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectcontrolP5.ControllerGroup
controlP5.Tab
public class Tab
Tab extends ControllerGroup, for more available methods see the ControllerGroup documentation.
/** * 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 |
---|
public Tab(ControlP5 theControlP5, ControlWindow theControlWindow, java.lang.String theName)
theControlP5
- ControlP5theControlWindow
- ControlWindowtheName
- StringMethod Detail |
---|
public void setLabel(java.lang.String theLabel)
setLabel
in interface ControllerInterface
setLabel
in class ControllerGroup
theLabel
- Stringpublic Tab setWidth(int theWidth)
setWidth
in class ControllerGroup
theWidth
-
public Tab setHeight(int theHeight)
setHeight
in class ControllerGroup
public void mousePressed()
public void setActive(boolean theFlag)
theFlag
- booleanpublic void moveTo(ControlWindow theWindow)
moveTo
in class ControllerGroup
public Tab activateEvent(boolean theFlag)
theFlag
- booleanpublic void addToXMLElement(ControlP5XMLElement theElement)
theElement
- ControlP5XMLElementpublic java.lang.String stringValue()
stringValue
in interface ControllerInterface
stringValue
in class ControllerGroup
public float value()
value
in interface ControllerInterface
value
in class ControllerGroup
public void setValue(float theValue)
theValue
- floatpublic void setStringValue(java.lang.String theValue)
theValue
- String
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |