controlP5
Class Label

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

public class Label
extends java.lang.Object
implements CDrawable

Label description tbd.

+Example
/**
 * ControlP5 TextLabel
 * by andreas schlegel, 2009
 */

import controlP5.*;

ControlP5 controlP5;

Textlabel myTextlabelA;
Textlabel myTextlabelB;

void setup() {
  size(400,400);
  frameRate(30);
  controlP5 = new ControlP5(this);
  controlP5.setControlFont(new ControlFont(createFont("Georgia",20), 20));

  myTextlabelA = controlP5.addTextlabel("label","A SINGLE TESTLABEL.",20,134);
  myTextlabelA.setColorValue(0xffcccccc);

  myTextlabelB = new Textlabel(this,"a single textlabel big stuff.",20,20,400,200);
}



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


Field Summary
 ControllerStyle _myControllerStyle
           
static BitFontRenderer bitFontRenderer
           
 boolean isToUpperCase
           
static int LABEL_WIDTH_OFFSET
           
 CVector3f position
           
 
Constructor Summary
Label(processing.core.PApplet theApplet, java.lang.String theText, int theWidth, int theHeight)
           
Label(processing.core.PApplet theApplet, java.lang.String theText, int theWidth, int theHeight, int theColor)
           
 
Method Summary
 Label adjust()
          work around, fix the issue with cutting off a label when setting a new font for a label.
 int color()
          Deprecated.  
 void disableColorBackground()
           
 void draw(processing.core.PApplet theApplet)
          draw a textlabel.
 void draw(processing.core.PApplet theApplet, int theX, int theY)
          draw a textlabel at a given location xy.
 void enableColorBackground()
           
 void fixedSize(boolean theFixedSize)
          Deprecated.  
 int getColor()
           
 ControlFont getControlFont()
           
 int getFont()
          returns the index of the current bitFont.
 int getLineHeight()
           
 java.lang.String getText()
           
 int height()
           
 int lineHeight()
          Deprecated.  
 void multiline(boolean theFlag)
           
 int offset()
           
 void set(java.lang.String theText)
          set the text of the label.
 void set(java.lang.String theText, boolean isFixedSize)
           
 void set(java.lang.String theText, int theColor)
           
 void set(java.lang.String theText, int theColor, boolean isFixedSize)
           
 void setColor(int theColor)
           
 void setColor(int theColor, boolean theFixedSizeFlag)
           
 void setColorBackground(int theColor)
           
 ControlFont setControlFont(ControlFont theControlFont)
           
 void setControlFontSize(int theSize)
           
 void setFixedSize(boolean theFixedSize)
           
 Label setFont(int theFont)
          a textlabel is an image containing text rendered from a bitfont source image.
 void setHeight(int theValue)
           
 void setOffset(float theValue)
           
 void setVisible(boolean theValue)
           
 void setWidth(int theValue)
           
 void setWithCursorPosition(java.lang.String theText, int theCursorPosition)
           
 void setWithCursorPosition(java.lang.String theText, int theCursorPosition, int theOffsetX)
           
 ControllerStyle style()
           
 int textHeight()
           
 java.lang.String toString()
           
 void toUpperCase(boolean theFlag)
          set the text of the label to upperCase.
 int width()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isToUpperCase

public boolean isToUpperCase

bitFontRenderer

public static BitFontRenderer bitFontRenderer

position

public CVector3f position

LABEL_WIDTH_OFFSET

public static int LABEL_WIDTH_OFFSET

_myControllerStyle

public ControllerStyle _myControllerStyle
Constructor Detail

Label

public Label(processing.core.PApplet theApplet,
             java.lang.String theText,
             int theWidth,
             int theHeight,
             int theColor)
Parameters:
theApplet -
theText -
theWidth -
theHeight -
theColor -

Label

public Label(processing.core.PApplet theApplet,
             java.lang.String theText,
             int theWidth,
             int theHeight)
Method Detail

toUpperCase

public void toUpperCase(boolean theFlag)
set the text of the label to upperCase.

Parameters:
theFlag - boolean

draw

public void draw(processing.core.PApplet theApplet,
                 int theX,
                 int theY)
draw a textlabel at a given location xy.

Parameters:
theApplet - PApplet
theX - int
theY - int

draw

public void draw(processing.core.PApplet theApplet)
draw a textlabel.

Specified by:
draw in interface CDrawable
Parameters:
theApplet - PApplet

set

public void set(java.lang.String theText)
set the text of the label. when setting the text, the fixedSize flag will be temporarily overwritten and set to false. after the text has been set, the fixedSize flag is set back to its previous value. use set(String, true) to set text for a fixed size area.

Parameters:
theText -

set

public void set(java.lang.String theText,
                int theColor)

set

public void set(java.lang.String theText,
                boolean isFixedSize)

set

public void set(java.lang.String theText,
                int theColor,
                boolean isFixedSize)

setWithCursorPosition

public void setWithCursorPosition(java.lang.String theText,
                                  int theCursorPosition)

setWithCursorPosition

public void setWithCursorPosition(java.lang.String theText,
                                  int theCursorPosition,
                                  int theOffsetX)

setFont

public Label setFont(int theFont)
a textlabel is an image containing text rendered from a bitfont source image. available bit fonts are: standard56, standard58, synt24, grixel. the font of a textlabel can be changed by using setFont(int theFontIndex) theFontIndex is of type int and available indexes are stored in the constants ControlP5.standard56, ControlP5.standard58, ControlP5.synt24, ControlP5.grixel available characters for each pixelfont range from ascii code 32-126

Parameters:
theFont - int

getFont

public int getFont()
returns the index of the current bitFont.

Returns:

setControlFont

public ControlFont setControlFont(ControlFont theControlFont)

getControlFont

public ControlFont getControlFont()

setControlFontSize

public void setControlFontSize(int theSize)

adjust

public Label adjust()
work around, fix the issue with cutting off a label when setting a new font for a label.


multiline

public void multiline(boolean theFlag)

setOffset

public void setOffset(float theValue)

offset

public int offset()

lineHeight

public int lineHeight()
Deprecated. 

Returns:

getLineHeight

public int getLineHeight()

textHeight

public int textHeight()

fixedSize

public void fixedSize(boolean theFixedSize)
Deprecated. 

Parameters:
theFixedSize -

setFixedSize

public void setFixedSize(boolean theFixedSize)

color

public int color()
Deprecated. 

Returns:

getColor

public int getColor()

setColor

public void setColor(int theColor)

setColor

public void setColor(int theColor,
                     boolean theFixedSizeFlag)

setColorBackground

public void setColorBackground(int theColor)

disableColorBackground

public void disableColorBackground()

enableColorBackground

public void enableColorBackground()

width

public int width()

height

public int height()

setWidth

public void setWidth(int theValue)

setHeight

public void setHeight(int theValue)

setVisible

public void setVisible(boolean theValue)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getText

public java.lang.String getText()

style

public ControllerStyle style()


processing library controlP5 by Andreas Schlegel. (c) 2010