public class ControllerStyle
extends java.lang.Object
implements java.io.Serializable
Label.getStyle()
,
Serialized Form/**
* ControlP5 ControllerStyle
*
*
* find a list of public methods available for the ControllerStyle Controller
* at the bottom of this sketch.
*
* by Andreas Schlegel, 2011
* www.sojamo.de/libraries/controlp5
*
*/
import controlP5.*;
ControlP5 cp5;
float v1 = 50, v2 = 100, v3 = 100, v4 = 100;
void setup() {
size(400,600);
smooth();
noStroke();
cp5 = new ControlP5(this);
cp5.begin(100,100);
cp5.addSlider("v1",0,255).linebreak();
cp5.addSlider("v2",0,200).linebreak();
cp5.addSlider("v3",0,300).linebreak();
cp5.addSlider("v4",0,400);
cp5.end();
// change the caption label for controller v1 and apply styles
cp5.getController("v1").setCaptionLabel("Background");
style("v1");
// change the caption label for controller v2 and apply styles
cp5.getController("v2").setCaptionLabel("Ellipse A");
style("v2");
// change the caption label for controller v3 and apply styles
cp5.getController("v3").setCaptionLabel("Ellipse B");
style("v3");
// change the caption label for controller v3 and apply styles
cp5.getController("v4").setCaptionLabel("Ellipse C");
style("v4");
}
void style(String theControllerName) {
Controller c = cp5.getController(theControllerName);
// adjust the height of the controller
c.setHeight(15);
// add some padding to the caption label background
c.getCaptionLabel().getStyle().setPadding(4,4,3,4);
// shift the caption label up by 4px
c.getCaptionLabel().getStyle().setMargin(-4,0,0,0);
// set the background color of the caption label
c.getCaptionLabel().setColorBackground(color(10,20,30,140));
}
void draw() {
background(v1);
fill(255,255,220,100);
ellipse(width/2-100, height/2-100,v2 + 50,v2 + 50);
ellipse(width/2+100, height/2,v3,v3);
ellipse(width/2, height/2+100,v4,v4);
}
/*
a list of all methods available for the ControllerStyle Controller
use ControlP5.printPublicMethodsFor(ControllerStyle.class);
to print the following list into the console.
You can find further details about class ControllerStyle in the javadoc.
Format:
ClassName : returnType methodName(parameter type)
controlP5.ControllerStyle : ControllerStyle margin(int)
controlP5.ControllerStyle : ControllerStyle margin(int, int, int, int)
controlP5.ControllerStyle : ControllerStyle moveMargin(int, int, int, int)
controlP5.ControllerStyle : ControllerStyle movePadding(int, int, int, int)
controlP5.ControllerStyle : ControllerStyle padding(int)
controlP5.ControllerStyle : ControllerStyle padding(int, int, int, int)
controlP5.ControllerStyle : ControllerStyle setMargin(int, int, int, int)
controlP5.ControllerStyle : ControllerStyle setMarginBottom(int)
controlP5.ControllerStyle : ControllerStyle setMarginLeft(int)
controlP5.ControllerStyle : ControllerStyle setMarginRight(int)
controlP5.ControllerStyle : ControllerStyle setMarginTop(int)
controlP5.ControllerStyle : ControllerStyle setPadding(int, int, int, int)
controlP5.ControllerStyle : ControllerStyle setPaddingBottom(int)
controlP5.ControllerStyle : ControllerStyle setPaddingLeft(int)
controlP5.ControllerStyle : ControllerStyle setPaddingRight(int)
controlP5.ControllerStyle : ControllerStyle setPaddingTop(int)
java.lang.Object : String toString()
java.lang.Object : boolean equals(Object)
*/
Modifier and Type | Field and Description |
---|---|
int |
background |
int |
backgroundHeight |
int |
backgroundWidth |
int |
color |
int |
marginBottom |
int |
marginLeft |
int |
marginRight |
int |
marginTop |
int |
paddingBottom |
int |
paddingLeft |
int |
paddingRight |
int |
paddingTop |
Constructor and Description |
---|
ControllerStyle() |
Modifier and Type | Method and Description |
---|---|
ControllerStyle |
margin(int theValue) |
ControllerStyle |
margin(int theTop,
int theRight,
int theBottom,
int theLeft) |
ControllerStyle |
moveMargin(int theTop,
int theRight,
int theBottom,
int theLeft) |
ControllerStyle |
movePadding(int theTop,
int theRight,
int theBottom,
int theLeft) |
ControllerStyle |
padding(int theValue) |
ControllerStyle |
padding(int theTop,
int theRight,
int theBottom,
int theLeft) |
ControllerStyle |
setMargin(int theTop,
int theRight,
int theBottom,
int theLeft) |
ControllerStyle |
setMarginBottom(int theValue) |
ControllerStyle |
setMarginLeft(int theValue) |
ControllerStyle |
setMarginRight(int theValue) |
ControllerStyle |
setMarginTop(int theValue) |
ControllerStyle |
setPadding(int theTop,
int theRight,
int theBottom,
int theLeft) |
ControllerStyle |
setPaddingBottom(int theValue) |
ControllerStyle |
setPaddingLeft(int theValue) |
ControllerStyle |
setPaddingRight(int theValue) |
ControllerStyle |
setPaddingTop(int theValue) |
public int background
public int backgroundHeight
public int backgroundWidth
public int color
public int marginBottom
public int marginLeft
public int marginRight
public int marginTop
public int paddingBottom
public int paddingLeft
public int paddingRight
public int paddingTop
public ControllerStyle margin(int theValue)
public ControllerStyle margin(int theTop, int theRight, int theBottom, int theLeft)
public ControllerStyle moveMargin(int theTop, int theRight, int theBottom, int theLeft)
public ControllerStyle movePadding(int theTop, int theRight, int theBottom, int theLeft)
public ControllerStyle padding(int theValue)
public ControllerStyle padding(int theTop, int theRight, int theBottom, int theLeft)
public ControllerStyle setMargin(int theTop, int theRight, int theBottom, int theLeft)
public ControllerStyle setMarginBottom(int theValue)
public ControllerStyle setMarginLeft(int theValue)
public ControllerStyle setMarginRight(int theValue)
public ControllerStyle setMarginTop(int theValue)
public ControllerStyle setPadding(int theTop, int theRight, int theBottom, int theLeft)
public ControllerStyle setPaddingBottom(int theValue)
public ControllerStyle setPaddingLeft(int theValue)
public ControllerStyle setPaddingRight(int theValue)
public ControllerStyle setPaddingTop(int theValue)
processing library controlP5 by Andreas Schlegel. (c) 2006-2015