controlP5
Class ControllerStyle
java.lang.Object
controlP5.ControllerStyle
- All Implemented Interfaces:
- java.io.Serializable
public class ControllerStyle
- extends java.lang.Object
- implements java.io.Serializable
Labels use the ControllerStyle class to store margin and padding information.
- See Also:
Label.getStyle()
,
Serialized Form
- +Example
/**
* 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)
*/
Method Summary |
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)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
background
public int background
backgroundHeight
public int backgroundHeight
backgroundWidth
public int backgroundWidth
color
public int color
marginBottom
public int marginBottom
marginLeft
public int marginLeft
marginRight
public int marginRight
marginTop
public int marginTop
paddingBottom
public int paddingBottom
paddingLeft
public int paddingLeft
paddingRight
public int paddingRight
paddingTop
public int paddingTop
ControllerStyle
public ControllerStyle()
margin
public ControllerStyle margin(int theValue)
margin
public ControllerStyle margin(int theTop,
int theRight,
int theBottom,
int theLeft)
moveMargin
public ControllerStyle moveMargin(int theTop,
int theRight,
int theBottom,
int theLeft)
movePadding
public ControllerStyle movePadding(int theTop,
int theRight,
int theBottom,
int theLeft)
padding
public ControllerStyle padding(int theValue)
padding
public ControllerStyle padding(int theTop,
int theRight,
int theBottom,
int theLeft)
setMargin
public ControllerStyle setMargin(int theTop,
int theRight,
int theBottom,
int theLeft)
setMarginBottom
public ControllerStyle setMarginBottom(int theValue)
setMarginLeft
public ControllerStyle setMarginLeft(int theValue)
setMarginRight
public ControllerStyle setMarginRight(int theValue)
setMarginTop
public ControllerStyle setMarginTop(int theValue)
setPadding
public ControllerStyle setPadding(int theTop,
int theRight,
int theBottom,
int theLeft)
setPaddingBottom
public ControllerStyle setPaddingBottom(int theValue)
setPaddingLeft
public ControllerStyle setPaddingLeft(int theValue)
setPaddingRight
public ControllerStyle setPaddingRight(int theValue)
setPaddingTop
public ControllerStyle setPaddingTop(int theValue)
processing library controlP5 by Andreas Schlegel. (c) 2006-2012