|
libgdx API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.badlogic.gdx.scenes.scene2d.Actor
com.badlogic.gdx.scenes.scene2d.ui.Widget
com.badlogic.gdx.scenes.scene2d.ui.Label
public class Label
A text label, with optional word wrapping.
The preferred size of the label is determined by the actual text bounds, unless word wrap is enabled.
| Nested Class Summary | |
|---|---|
static class |
Label.LabelStyle
The style for a label, see Label. |
| Field Summary |
|---|
| Fields inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
|---|
actions, color, height, name, originX, originY, parent, rotation, scaleX, scaleY, stage, touchable, visible, width, x, y |
| Constructor Summary | |
|---|---|
Label(Skin skin)
|
|
Label(java.lang.String text,
Label.LabelStyle style)
|
|
Label(java.lang.String text,
Label.LabelStyle style,
java.lang.String name)
|
|
Label(java.lang.String text,
Skin skin)
|
|
Label(java.lang.String text,
java.lang.String fontName,
Color color,
Skin skin)
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.String text,
java.lang.String fontName,
java.lang.String colorName,
Skin skin)
Creates a label, using a Label.LabelStyle that has a BitmapFont with the specified name and the specified color from the
skin. |
|
| Method Summary | |
|---|---|
void |
draw(SpriteBatch batch,
float parentAlpha)
If this method is overridden, the super method or Widget.validate() should be called to ensure the widget is laid out. |
Color |
getColor()
|
float |
getPrefHeight()
|
float |
getPrefWidth()
|
Label.LabelStyle |
getStyle()
Returns the label's style. |
java.lang.String |
getText()
|
BitmapFont.TextBounds |
getTextBounds()
|
void |
layout()
Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child and calls Layout.invalidate() and then Layout.validate() on each one. |
void |
setAlignment(int wrapAlign)
|
void |
setAlignment(int labelAlign,
int lineAlign)
|
void |
setColor(Color tint)
|
void |
setColor(float color)
|
void |
setColor(float r,
float g,
float b,
float a)
|
void |
setStyle(Label.LabelStyle style)
|
void |
setText(java.lang.String text)
|
void |
setWrap(boolean wrap)
If false, the text will only wrap where it contains newlines (\n). |
| Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Widget |
|---|
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, hit, invalidate, invalidateHierarchy, needsLayout, pack, toScreenCoordinates, touchDown, touchDragged, touchUp, validate |
| Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
|---|
act, action, clearActions, getStage, isMarkedToRemove, keyDown, keyTyped, keyUp, markToRemove, remove, scrolled, toLocalCoordinates, toString, touchMoved |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Label(Skin skin)
public Label(java.lang.String text,
Skin skin)
public Label(java.lang.String text,
java.lang.String fontName,
Color color,
Skin skin)
Label.LabelStyle that has a BitmapFont with the specified name from the skin and the specified
color.
public Label(java.lang.String text,
java.lang.String fontName,
java.lang.String colorName,
Skin skin)
Label.LabelStyle that has a BitmapFont with the specified name and the specified color from the
skin.
public Label(java.lang.String text,
Label.LabelStyle style)
public Label(java.lang.String text,
Label.LabelStyle style,
java.lang.String name)
| Method Detail |
|---|
public void setStyle(Label.LabelStyle style)
public Label.LabelStyle getStyle()
setStyle(LabelStyle) is
called.
public void setText(java.lang.String text)
public java.lang.String getText()
public BitmapFont.TextBounds getTextBounds()
public void setWrap(boolean wrap)
public void setAlignment(int wrapAlign)
wrapAlign - Aligns each line of text horizontally and all the text vertically.Align
public void setAlignment(int labelAlign,
int lineAlign)
labelAlign - Aligns all the text with the label widget.lineAlign - Aligns each line of text (left, right, or center).Alignpublic void setColor(float color)
public void setColor(Color tint)
public void setColor(float r,
float g,
float b,
float a)
public Color getColor()
public void layout()
LayoutLayout.invalidate() and then Layout.validate() on each one. Usually this should not be called directly, instead
Layout.validate() should be used.
layout in interface Layoutlayout in class Widget
public void draw(SpriteBatch batch,
float parentAlpha)
WidgetWidget.validate() should be called to ensure the widget is laid out.
draw in class Widgetbatch - the spritebatch to render withparentAlpha - the parent's alpha value.public float getPrefWidth()
getPrefWidth in interface LayoutgetPrefWidth in class Widgetpublic float getPrefHeight()
getPrefHeight in interface LayoutgetPrefHeight in class Widget
|
libgdx API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||