| Modifier and Type | Class and Description |
|---|---|
static class |
Label.LabelStyle
The style for a label, see
Label. |
| Constructor and Description |
|---|
Label(java.lang.CharSequence text,
Label.LabelStyle style) |
Label(java.lang.CharSequence text,
Skin skin) |
Label(java.lang.CharSequence text,
Skin skin,
java.lang.String styleName) |
Label(java.lang.CharSequence text,
Skin skin,
java.lang.String fontName,
Color color)
Creates a label, using a
Label.LabelStyle that has a BitmapFont with the specified name from the skin and the specified
color. |
Label(java.lang.CharSequence text,
Skin skin,
java.lang.String fontName,
java.lang.String colorName)
Creates a label, using a
Label.LabelStyle that has a BitmapFont with the specified name and the specified color from the
skin. |
| Modifier and Type | Method and Description |
|---|---|
void |
draw(Batch batch,
float parentAlpha)
If this method is overridden, the super method or
Widget.validate() should be called to ensure the widget is laid out. |
protected BitmapFontCache |
getBitmapFontCache()
Allows subclasses to access the cache in
draw(Batch, float). |
float |
getFontScaleX() |
float |
getFontScaleY() |
GlyphLayout |
getGlyphLayout() |
int |
getLabelAlign() |
int |
getLineAlign() |
float |
getPrefHeight() |
float |
getPrefWidth() |
Label.LabelStyle |
getStyle()
Returns the label's style.
|
StringBuilder |
getText() |
void |
invalidate()
Invalidates this actor's layout, causing
Layout.layout() to happen the next time Layout.validate() is called. |
void |
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child,
calls
Layout.invalidate() on any each child whose width or height has changed, and calls Layout.validate() on each
child. |
void |
setAlignment(int alignment) |
void |
setAlignment(int labelAlign,
int lineAlign) |
void |
setEllipsis(boolean ellipsis)
When true the text will be truncated "..." if it does not fit within the width of the label.
|
void |
setEllipsis(java.lang.String ellipsis)
When non-null the text will be truncated "..." if it does not fit within the width of the label.
|
void |
setFontScale(float fontScale) |
void |
setFontScale(float fontScaleX,
float fontScaleY) |
void |
setFontScaleX(float fontScaleX) |
void |
setFontScaleY(float fontScaleY) |
void |
setStyle(Label.LabelStyle style) |
void |
setText(java.lang.CharSequence newText) |
void |
setWrap(boolean wrap)
If false, the text will only wrap where it contains newlines (\n).
|
boolean |
textEquals(java.lang.CharSequence other) |
java.lang.String |
toString() |
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validateact, addAction, addCaptureListener, addListener, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasParent, hit, isAscendantOf, isDescendantOf, isTouchable, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFrontpublic Label(java.lang.CharSequence text,
Skin skin)
public Label(java.lang.CharSequence text,
Skin skin,
java.lang.String styleName)
public Label(java.lang.CharSequence text,
Skin skin,
java.lang.String fontName,
Color color)
Label.LabelStyle that has a BitmapFont with the specified name from the skin and the specified
color.public Label(java.lang.CharSequence text,
Skin skin,
java.lang.String fontName,
java.lang.String colorName)
Label.LabelStyle that has a BitmapFont with the specified name and the specified color from the
skin.public Label(java.lang.CharSequence text,
Label.LabelStyle style)
public void setStyle(Label.LabelStyle style)
public Label.LabelStyle getStyle()
setStyle(LabelStyle) is
called.public void setText(java.lang.CharSequence newText)
newText - May be null, "" will be used.public boolean textEquals(java.lang.CharSequence other)
public StringBuilder getText()
public void invalidate()
LayoutLayout.layout() to happen the next time Layout.validate() is called. This
method should be called when state changes in the actor that requires a layout but does not change the minimum, preferred,
maximum, or actual size of the actor (meaning it does not affect the parent actor's layout).invalidate in interface Layoutinvalidate in class Widgetpublic void layout()
LayoutLayout.invalidate() on any each child whose width or height has changed, and calls Layout.validate() on each
child. This method should almost never be called directly, instead Layout.validate() should be used.public void draw(Batch batch, float parentAlpha)
WidgetWidget.validate() should be called to ensure the widget is laid out.public float getPrefWidth()
getPrefWidth in interface LayoutgetPrefWidth in class Widgetpublic float getPrefHeight()
getPrefHeight in interface LayoutgetPrefHeight in class Widgetpublic GlyphLayout getGlyphLayout()
public void setWrap(boolean wrap)
When wrap is enabled, the label's preferred height depends on the width of the label. In some cases the parent of the label will need to layout twice: once to set the width of the label and a second time to adjust to the label's new preferred height.
public int getLabelAlign()
public int getLineAlign()
public void setAlignment(int alignment)
alignment - Aligns all the text within the label (default left center) and each line of text horizontally (default
left).Alignpublic void setAlignment(int labelAlign,
int lineAlign)
labelAlign - Aligns all the text within the label (default left center).lineAlign - Aligns each line of text horizontally (default left).Alignpublic void setFontScale(float fontScale)
public void setFontScale(float fontScaleX,
float fontScaleY)
public float getFontScaleX()
public void setFontScaleX(float fontScaleX)
public float getFontScaleY()
public void setFontScaleY(float fontScaleY)
public void setEllipsis(java.lang.String ellipsis)
public void setEllipsis(boolean ellipsis)
protected BitmapFontCache getBitmapFontCache()
draw(Batch, float).