|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pulpcore.sprite.Sprite pulpcore.sprite.Label
public class Label
The Label is a Sprite that displays text. The text can be formatted using printf-style parameters
StringUtil
Field Summary | |
---|---|
Int |
numDisplayChars
|
Fields inherited from class pulpcore.sprite.Sprite |
---|
alpha, anchorX, anchorY, angle, CENTER, DEFAULT, EAST, enabled, height, NORTH, NORTH_EAST, NORTH_WEST, pixelSnapping, SOUTH, SOUTH_EAST, SOUTH_WEST, visible, WEST, width, x, y |
Constructor Summary | |
---|---|
Label(CoreFont font,
String text,
double x,
double y)
|
|
Label(CoreFont font,
String text,
double x,
double y,
double w,
double h)
If height < 0, the height is automatically set to fit the font height. |
|
Label(CoreFont font,
String text,
int x,
int y)
|
|
Label(CoreFont font,
String text,
int x,
int y,
int w,
int h)
If height < 0, the height is automatically set to fit the font height. |
|
Label(String text,
double x,
double y)
|
|
Label(String text,
double x,
double y,
double w,
double h)
If height < 0, the height is automatically set to fit the font height. |
|
Label(String text,
int x,
int y)
|
|
Label(String text,
int x,
int y,
int w,
int h)
If height < 0, the height is automatically set to fit the font height. |
Method Summary | |
---|---|
static Group |
createMultilineLabel(CoreFont font,
String text,
double x,
double y)
Creates a Group of Labels with the specified Font. |
static Group |
createMultilineLabel(CoreFont font,
String text,
double x,
double y,
int viewWidth)
Creates a Group of Labels with the specified Font. |
static Group |
createMultilineLabel(CoreFont font,
String text,
int x,
int y)
Creates a Group of Labels with the specified Font. |
static Group |
createMultilineLabel(CoreFont font,
String text,
int x,
int y,
int viewWidth)
Creates a Group of Labels with the specified Font. |
static Group |
createMultilineLabel(String text,
double x,
double y)
Creates a Group of Labels with the system font. |
static Group |
createMultilineLabel(String text,
double x,
double y,
int viewWidth)
Creates a Group of Labels with the system font. |
static Group |
createMultilineLabel(String text,
int x,
int y)
Creates a Group of Labels with the system font. |
static Group |
createMultilineLabel(String text,
int x,
int y,
int viewWidth)
Creates a Group of Labels with the system font. |
protected void |
drawSprite(CoreGraphics g)
Draws the sprite. |
protected void |
drawText(CoreGraphics g,
String text)
|
CoreFont |
getFont()
|
protected int |
getNaturalHeight()
Gets the fixed-point value of the Sprite's natural height. |
protected int |
getNaturalWidth()
Gets the fixed-point value of the Sprite's natural width. |
String |
getText()
|
void |
propertyChange(Property p)
On a property change this Sprite is marked as dirty. |
void |
setFont(CoreFont font)
Set this Label's font and resizes it if necessary. |
void |
setFormatArg(Object arg)
|
void |
setFormatArgs(Object[] args)
|
void |
setText(String text)
|
void |
update(int elapsedTime)
Updates all of this Sprite's properties. |
Methods inherited from class pulpcore.sprite.Sprite |
---|
bindLocationTo, bindSizeTo, clearCursor, clearDirtyRect, contains, draw, getBlendMode, getCursor, getDirtyRect, getFilter, getLocalX, getLocalY, getParent, getPixelLevelChecks, getRoot, getScene2D, getTag, getViewX, getViewX, getViewY, getViewY, intersects, isDirty, isEnabled, isEnabledAndVisible, isMouseDoubleClicked, isMouseDown, isMouseHover, isMouseOver, isMousePressed, isMouseReleased, isMouseTripleClicked, isMouseWheelRotated, isOpaque, isPick, isPickEnabledAndVisible, isTransparent, move, move, move, move, move, move, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, removeFromParent, scale, scale, scale, scale, scale, scale, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, scaleTo, setAnchor, setAnchor, setBlendMode, setCursor, setDirty, setFilter, setLocation, setLocation, setSize, setSize, setTag, translate, translate, updateDirtyRect |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final Int numDisplayChars
Constructor Detail |
---|
public Label(String text, int x, int y)
public Label(String text, double x, double y)
public Label(String text, int x, int y, int w, int h)
public Label(String text, double x, double y, double w, double h)
public Label(CoreFont font, String text, int x, int y)
public Label(CoreFont font, String text, double x, double y)
public Label(CoreFont font, String text, int x, int y, int w, int h)
public Label(CoreFont font, String text, double x, double y, double w, double h)
Method Detail |
---|
public void propertyChange(Property p)
Sprite
propertyChange
in interface PropertyListener
propertyChange
in class Sprite
p
- the property whose value has changed.protected int getNaturalWidth()
Sprite
ImageSprite
, the natural width is the
width of the image.
getNaturalWidth
in class Sprite
protected int getNaturalHeight()
Sprite
ImageSprite
, the natural height is the
height of the image.
getNaturalHeight
in class Sprite
public void update(int elapsedTime)
Sprite
update
in class Sprite
public CoreFont getFont()
public void setFont(CoreFont font)
public String getText()
public void setText(String text)
public void setFormatArg(Object arg)
public void setFormatArgs(Object[] args)
protected void drawSprite(CoreGraphics g)
Sprite
This method may be called multiple times for each dirty rectangle. The clip of the graphics context will be set to the current dirty rectangle.
When the contents of this sprite change (in another words, the graphic output of this method
will be different from the last time it is called), subclasses should call
setDirty(true)
.
Implementors should not save a reference to the graphics context as it can change between calls to this method.
drawSprite
in class Sprite
protected void drawText(CoreGraphics g, String text)
public static Group createMultilineLabel(String text, int x, int y)
public static Group createMultilineLabel(String text, int x, int y, int viewWidth)
public static Group createMultilineLabel(String text, double x, double y)
public static Group createMultilineLabel(String text, double x, double y, int viewWidth)
public static Group createMultilineLabel(CoreFont font, String text, int x, int y)
public static Group createMultilineLabel(CoreFont font, String text, int x, int y, int viewWidth)
public static Group createMultilineLabel(CoreFont font, String text, double x, double y)
public static Group createMultilineLabel(CoreFont font, String text, double x, double y, int viewWidth)
|
PulpCore | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |