controlP5
Class Label

java.lang.Object
  extended by controlP5.Label
All Implemented Interfaces:
CDrawable

public class Label
extends java.lang.Object
implements CDrawable

A custom label using controlP5's BitFonts or PFont based ControlFonts.

See Also:
ControlFont
+Example
/**
* ControlP5 Textlabel
*
*
* find a list of public methods available for the Textlabel Controller
* at the bottom of this sketch.
*
* by Andreas Schlegel, 2012
* www.sojamo.de/libraries/controlp5
*
*/

import controlP5.*;

ControlP5 cp5;

Textlabel myTextlabelA;
Textlabel myTextlabelB;

void setup() {
  size(700,400);
  cp5 = new ControlP5(this);

  myTextlabelA = cp5.addTextlabel("label")
                    .setText("A single ControlP5 textlabel, in yellow.")
                    .setPosition(100,50)
                    .setColorValue(0xffffff00)
                    .setFont(createFont("Georgia",20))
                    ;

  myTextlabelB = new Textlabel(cp5,"Another textlabel, not created through ControlP5 needs to be rendered separately by calling Textlabel.draw(PApplet).",100,100,400,200);

}



void draw() {
  background(0);
  myTextlabelB.draw(this); 
}



/*
a list of all methods available for the Textlabel Controller
use ControlP5.printPublicMethodsFor(Textlabel.class);
to print the following list into the console.

You can find further details about class Textlabel in the javadoc.

Format:
ClassName : returnType methodName(parameter type)

controlP5.Textlabel : Label get() 
controlP5.Textlabel : Textlabel setColor(int) 
controlP5.Textlabel : Textlabel setFont(ControlFont) 
controlP5.Textlabel : Textlabel setFont(PFont) 
controlP5.Textlabel : Textlabel setFont(int) 
controlP5.Textlabel : Textlabel setHeight(int) 
controlP5.Textlabel : Textlabel setLetterSpacing(int) 
controlP5.Textlabel : Textlabel setMultiline(boolean) 
controlP5.Textlabel : Textlabel setStringValue(String) 
controlP5.Textlabel : Textlabel setText(String) 
controlP5.Textlabel : Textlabel setValue(String) 
controlP5.Textlabel : Textlabel setValue(float) 
controlP5.Textlabel : Textlabel setWidth(int) 
controlP5.Textlabel : void draw() 
controlP5.Textlabel : void draw(PApplet) 
controlP5.Textlabel : void draw(int, int) 
controlP5.Controller : CColor getColor() 
controlP5.Controller : ControlBehavior getBehavior() 
controlP5.Controller : ControlWindow getControlWindow() 
controlP5.Controller : ControlWindow getWindow() 
controlP5.Controller : ControllerProperty getProperty(String) 
controlP5.Controller : ControllerProperty getProperty(String, String) 
controlP5.Controller : Label getCaptionLabel() 
controlP5.Controller : Label getValueLabel() 
controlP5.Controller : List getControllerPlugList() 
controlP5.Controller : PImage setImage(PImage) 
controlP5.Controller : PImage setImage(PImage, int) 
controlP5.Controller : PVector getAbsolutePosition() 
controlP5.Controller : PVector getPosition() 
controlP5.Controller : String getAddress() 
controlP5.Controller : String getInfo() 
controlP5.Controller : String getName() 
controlP5.Controller : String getStringValue() 
controlP5.Controller : String toString() 
controlP5.Controller : Tab getTab() 
controlP5.Controller : Textlabel addCallback(CallbackListener) 
controlP5.Controller : Textlabel addListener(ControlListener) 
controlP5.Controller : Textlabel bringToFront() 
controlP5.Controller : Textlabel bringToFront(ControllerInterface) 
controlP5.Controller : Textlabel hide() 
controlP5.Controller : Textlabel linebreak() 
controlP5.Controller : Textlabel listen(boolean) 
controlP5.Controller : Textlabel lock() 
controlP5.Controller : Textlabel plugTo(Object) 
controlP5.Controller : Textlabel plugTo(Object, String) 
controlP5.Controller : Textlabel plugTo(Object[]) 
controlP5.Controller : Textlabel plugTo(Object[], String) 
controlP5.Controller : Textlabel registerProperty(String) 
controlP5.Controller : Textlabel registerProperty(String, String) 
controlP5.Controller : Textlabel registerTooltip(String) 
controlP5.Controller : Textlabel removeBehavior() 
controlP5.Controller : Textlabel removeCallback() 
controlP5.Controller : Textlabel removeCallback(CallbackListener) 
controlP5.Controller : Textlabel removeListener(ControlListener) 
controlP5.Controller : Textlabel removeProperty(String) 
controlP5.Controller : Textlabel removeProperty(String, String) 
controlP5.Controller : Textlabel setArrayValue(float[]) 
controlP5.Controller : Textlabel setArrayValue(int, float) 
controlP5.Controller : Textlabel setBehavior(ControlBehavior) 
controlP5.Controller : Textlabel setBroadcast(boolean) 
controlP5.Controller : Textlabel setCaptionLabel(String) 
controlP5.Controller : Textlabel setColor(CColor) 
controlP5.Controller : Textlabel setColorActive(int) 
controlP5.Controller : Textlabel setColorBackground(int) 
controlP5.Controller : Textlabel setColorCaptionLabel(int) 
controlP5.Controller : Textlabel setColorForeground(int) 
controlP5.Controller : Textlabel setColorValueLabel(int) 
controlP5.Controller : Textlabel setDecimalPrecision(int) 
controlP5.Controller : Textlabel setDefaultValue(float) 
controlP5.Controller : Textlabel setHeight(int) 
controlP5.Controller : Textlabel setId(int) 
controlP5.Controller : Textlabel setImages(PImage, PImage, PImage) 
controlP5.Controller : Textlabel setImages(PImage, PImage, PImage, PImage) 
controlP5.Controller : Textlabel setLabelVisible(boolean) 
controlP5.Controller : Textlabel setLock(boolean) 
controlP5.Controller : Textlabel setMax(float) 
controlP5.Controller : Textlabel setMin(float) 
controlP5.Controller : Textlabel setMouseOver(boolean) 
controlP5.Controller : Textlabel setMoveable(boolean) 
controlP5.Controller : Textlabel setPosition(PVector) 
controlP5.Controller : Textlabel setPosition(float, float) 
controlP5.Controller : Textlabel setSize(PImage) 
controlP5.Controller : Textlabel setSize(int, int) 
controlP5.Controller : Textlabel setStringValue(String) 
controlP5.Controller : Textlabel setUpdate(boolean) 
controlP5.Controller : Textlabel setValueLabel(String) 
controlP5.Controller : Textlabel setView(ControllerView) 
controlP5.Controller : Textlabel setVisible(boolean) 
controlP5.Controller : Textlabel setWidth(int) 
controlP5.Controller : Textlabel show() 
controlP5.Controller : Textlabel unlock() 
controlP5.Controller : Textlabel unplugFrom(Object) 
controlP5.Controller : Textlabel unplugFrom(Object[]) 
controlP5.Controller : Textlabel unregisterTooltip() 
controlP5.Controller : Textlabel update() 
controlP5.Controller : Textlabel updateSize() 
controlP5.Controller : boolean isActive() 
controlP5.Controller : boolean isBroadcast() 
controlP5.Controller : boolean isInside() 
controlP5.Controller : boolean isLabelVisible() 
controlP5.Controller : boolean isListening() 
controlP5.Controller : boolean isLock() 
controlP5.Controller : boolean isMouseOver() 
controlP5.Controller : boolean isMousePressed() 
controlP5.Controller : boolean isMoveable() 
controlP5.Controller : boolean isUpdate() 
controlP5.Controller : boolean isVisible() 
controlP5.Controller : float getArrayValue(int) 
controlP5.Controller : float getDefaultValue() 
controlP5.Controller : float getMax() 
controlP5.Controller : float getMin() 
controlP5.Controller : float getValue() 
controlP5.Controller : float[] getArrayValue() 
controlP5.Controller : int getDecimalPrecision() 
controlP5.Controller : int getHeight() 
controlP5.Controller : int getId() 
controlP5.Controller : int getWidth() 
controlP5.Controller : int listenerSize() 
controlP5.Controller : void remove() 
controlP5.Controller : void setView(ControllerView, int) 
java.lang.Object : String toString() 
java.lang.Object : boolean equals(Object) 


*/




Field Summary
 int _myPaddingX
           
 int _myPaddingY
           
static int paddingX
           
static int paddingY
           
 
Constructor Summary
Label(ControlP5 theControlP5, java.lang.String theValue)
           
Label(ControlP5 theControlP5, java.lang.String theValue, int theWidth, int theHeight, int theColor)
           
 
Method Summary
 Label align(int[] a)
           
 Label align(int theX, int theY)
           
 Label alignX(int theX)
           
 Label alignY(int theY)
           
 Label disableColorBackground()
           
 void draw(processing.core.PApplet theApplet)
           
 void draw(processing.core.PApplet theApplet, int theX, int theY)
           
 void draw(processing.core.PApplet theApplet, int theX, int theY, ControllerInterface theController)
           
 Label enableColorBackground()
           
 int[] getAlign()
           
 int getColor()
           
 ControlFont getFont()
           
 int getHeight()
           
 int getLetterSpacing()
           
 int getLineHeight()
           
 float getOffsetYratio()
           
 int getOverflow()
           
 ControllerStyle getStyle()
           
 java.lang.String getText()
           
 java.lang.String getTextFormatted()
           
 int getTextHeight()
           
 int getWidth()
           
 Label hide()
           
 boolean isFixedSize()
           
 boolean isMultiline()
           
 boolean isToUpperCase()
           
 boolean isVisible()
           
 Label set(java.lang.String theValue)
           
 Label setColor(int theColor)
           
 Label setColor(int theValue, boolean theFlag)
           
 Label setColorBackground(int theColor)
           
 Label setFixedSize(boolean theValue)
           
 Label setFont(ControlFont theFont)
           
 Label setFont(int theBitFontIndex)
           
 Label setFont(processing.core.PFont thePFont)
           
 Label setHeight(int theHeight)
           
 Label setLetterSpacing(int theValue)
           
 Label setLineHeight(int theValue)
           
 Label setMultiline(boolean theValue)
           
 Label setOffsetY(int theValue)
           
 Label setOffsetYratio(float theValue)
           
 Label setPadding(int thePaddingX, int thePaddingY)
           
 Label setPaddingX(int thePaddingX)
           
 Label setPaddingY(int thePaddingY)
           
 Label setSize(int theSize)
           
 Label setText(java.lang.String theValue)
           
 Label setVisible(boolean theValue)
           
 Label setWidth(int theWidth)
           
 Label show()
           
 Label toUpperCase(boolean theValue)
           
 Label updateFont(ControlFont theFont)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_myPaddingX

public int _myPaddingX

_myPaddingY

public int _myPaddingY

paddingX

public static int paddingX

paddingY

public static int paddingY
Constructor Detail

Label

public Label(ControlP5 theControlP5,
             java.lang.String theValue)

Label

public Label(ControlP5 theControlP5,
             java.lang.String theValue,
             int theWidth,
             int theHeight,
             int theColor)
Method Detail

align

public Label align(int[] a)

align

public Label align(int theX,
                   int theY)

alignX

public Label alignX(int theX)

alignY

public Label alignY(int theY)

disableColorBackground

public Label disableColorBackground()

draw

public void draw(processing.core.PApplet theApplet)
Specified by:
draw in interface CDrawable
Parameters:
theApplet - PApplet

draw

public void draw(processing.core.PApplet theApplet,
                 int theX,
                 int theY)

draw

public void draw(processing.core.PApplet theApplet,
                 int theX,
                 int theY,
                 ControllerInterface theController)

enableColorBackground

public Label enableColorBackground()

getAlign

public int[] getAlign()

getColor

public int getColor()

getFont

public ControlFont getFont()

getHeight

public int getHeight()

getLetterSpacing

public int getLetterSpacing()

getLineHeight

public int getLineHeight()

getOffsetYratio

public float getOffsetYratio()

getOverflow

public int getOverflow()

getStyle

public ControllerStyle getStyle()

getText

public java.lang.String getText()

getTextFormatted

public java.lang.String getTextFormatted()

getTextHeight

public int getTextHeight()

getWidth

public int getWidth()

hide

public Label hide()

isFixedSize

public boolean isFixedSize()

isMultiline

public boolean isMultiline()

isToUpperCase

public boolean isToUpperCase()

isVisible

public boolean isVisible()

set

public Label set(java.lang.String theValue)

setColor

public Label setColor(int theColor)

setColor

public Label setColor(int theValue,
                      boolean theFlag)

setColorBackground

public Label setColorBackground(int theColor)

setFixedSize

public Label setFixedSize(boolean theValue)

setFont

public Label setFont(ControlFont theFont)

setFont

public Label setFont(int theBitFontIndex)

setFont

public Label setFont(processing.core.PFont thePFont)

setHeight

public Label setHeight(int theHeight)

setLetterSpacing

public Label setLetterSpacing(int theValue)

setLineHeight

public Label setLineHeight(int theValue)

setMultiline

public Label setMultiline(boolean theValue)

setOffsetY

public Label setOffsetY(int theValue)

setOffsetYratio

public Label setOffsetYratio(float theValue)

setPadding

public Label setPadding(int thePaddingX,
                        int thePaddingY)

setPaddingX

public Label setPaddingX(int thePaddingX)

setPaddingY

public Label setPaddingY(int thePaddingY)

setSize

public Label setSize(int theSize)

setText

public Label setText(java.lang.String theValue)

setVisible

public Label setVisible(boolean theValue)

setWidth

public Label setWidth(int theWidth)

show

public Label show()

toUpperCase

public Label toUpperCase(boolean theValue)

updateFont

public Label updateFont(ControlFont theFont)


processing library controlP5 by Andreas Schlegel. (c) 2006-2012