|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.badlogic.gdx.scenes.scene2d.Actor com.badlogic.gdx.scenes.scene2d.Group com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup com.badlogic.gdx.scenes.scene2d.ui.Table
public class Table
A group that sizes and positions children using table constraints. By default, Actor.getTouchable()
is
Touchable.childrenOnly
.
The preferred and minimum sizes are that of the children when laid out in columns and rows.
Constructor Summary | |
---|---|
Table()
|
|
Table(Skin skin)
Creates a table with a skin, which enables the add(String) and add(String, String) methods to be used. |
Method Summary | ||
---|---|---|
Cell<Actor> |
add()
Adds a cell without a widget. |
|
void |
add(Actor... actors)
|
|
Cell<Label> |
add(String text)
Adds a new cell with a label. |
|
Cell<Label> |
add(String text,
String labelStyleName)
Adds a new cell with a label. |
|
Cell<Label> |
add(String text,
String fontName,
Color color)
Adds a new cell with a label. |
|
Cell<Label> |
add(String text,
String fontName,
String colorName)
Adds a new cell with a label. |
|
|
add(T actor)
Adds a new cell to the table with the specified actor. |
|
Table |
align(int align)
Sets the alignment of the logical table within the table widget. |
|
Table |
background(Drawable background)
|
|
Table |
background(String drawableName)
|
|
Table |
bottom()
Adds Align.bottom and clears Align.top for the alignment of the logical table within the table widget. |
|
Table |
center()
Sets the alignment of the logical table within the table widget to Align.center . |
|
void |
clearChildren()
Removes all actors and cells from the table. |
|
Cell |
columnDefaults(int column)
Gets the cell values that will be used as the defaults for all cells in the specified column. |
|
Table |
debug()
Turns on all debug lines. |
|
Table |
debug(BaseTableLayout.Debug debug)
Turns on debug lines. |
|
Table |
debugCell()
Turns on cell debug lines. |
|
Table |
debugTable()
Turns on table debug lines. |
|
Table |
debugWidget()
Turns on widget debug lines. |
|
Cell |
defaults()
The cell values that will be used as the defaults for all cells. |
|
void |
draw(Batch batch,
float parentAlpha)
If this method is overridden, the super method or WidgetGroup.validate() should be called to ensure the widget group is laid
out. |
|
static void |
drawDebug(Stage stage)
Draws the debug lines for all tables in the stage. |
|
int |
getAlign()
|
|
Drawable |
getBackground()
|
|
|
getCell(T actor)
Returns the cell for the specified widget in this table, or null. |
|
List<Cell> |
getCells()
Returns the cells for this table. |
|
boolean |
getClip()
|
|
BaseTableLayout.Debug |
getDebug()
|
|
float |
getMinHeight()
|
|
float |
getMinWidth()
|
|
float |
getPadBottom()
|
|
Value |
getPadBottomValue()
|
|
float |
getPadLeft()
|
|
Value |
getPadLeftValue()
|
|
float |
getPadRight()
|
|
Value |
getPadRightValue()
|
|
float |
getPadTop()
|
|
Value |
getPadTopValue()
|
|
float |
getPadX()
Returns getPadLeft() plus getPadRight() . |
|
float |
getPadY()
Returns getPadTop() plus getPadBottom() . |
|
float |
getPrefHeight()
|
|
float |
getPrefWidth()
|
|
int |
getRow(float y)
Returns the row index for the y coordinate. |
|
Actor |
hit(float x,
float y,
boolean touchable)
Returns the deepest actor that contains the specified point and is touchable and
visible , or null if no actor was hit. |
|
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() any each child whose width or height has changed, and calls Layout.validate() on each child. |
|
Table |
left()
Adds Align.left and clears Align.right for the alignment of the logical table within the table widget. |
|
Table |
pad(float pad)
Sets the padTop, padLeft, padBottom, and padRight around the table to the specified value. |
|
Table |
pad(float top,
float left,
float bottom,
float right)
|
|
Table |
pad(Value pad)
Sets the padTop, padLeft, padBottom, and padRight around the table to the specified value. |
|
Table |
pad(Value top,
Value left,
Value bottom,
Value right)
|
|
Table |
padBottom(float padBottom)
Padding at the bottom edge of the table. |
|
Table |
padBottom(Value padBottom)
Padding at the bottom edge of the table. |
|
Table |
padLeft(float padLeft)
Padding at the left edge of the table. |
|
Table |
padLeft(Value padLeft)
Padding at the left edge of the table. |
|
Table |
padRight(float padRight)
Padding at the right edge of the table. |
|
Table |
padRight(Value padRight)
Padding at the right edge of the table. |
|
Table |
padTop(float padTop)
Padding at the top edge of the table. |
|
Table |
padTop(Value padTop)
Padding at the top edge of the table. |
|
boolean |
removeActor(Actor actor)
Removes an actor from this group. |
|
void |
reset()
Removes all actors and cells from the table (same as clearChildren() ) and additionally resets all table properties
and cell, column, and row defaults. |
|
Table |
right()
Adds Align.right and clears Align.left for the alignment of the logical table within the table widget. |
|
Cell |
row()
Indicates that subsequent cells should be added to a new row and returns the cell values that will be used as the defaults for all cells in the new row. |
|
void |
setBackground(Drawable background)
Sets the background drawable and adjusts the table's padding to match the background. |
|
void |
setBackground(Drawable background,
boolean adjustPadding)
Sets the background drawable and, if adjustPadding is true, sets the table's padding to Drawable.getBottomHeight() ,
Drawable.getTopHeight() , Drawable.getLeftWidth() , and Drawable.getRightWidth() . |
|
void |
setBackground(String drawableName)
Sets the background drawable from the skin and adjusts the table's padding to match the background. |
|
void |
setClip(boolean enabled)
Causes the contents to be clipped if they exceed the table widget bounds. |
|
void |
setRound(boolean round)
If true (the default), positions and sizes are rounded to integers. |
|
void |
setSkin(Skin skin)
|
|
Cell<Stack> |
stack(Actor... actors)
Adds a new cell to the table with the specified actors in a Stack . |
|
Table |
top()
Adds Align.top and clears Align.bottom for the alignment of the logical table within the table widget. |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup |
---|
getMaxHeight, getMaxWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, validate |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group |
---|
act, addActor, addActorAfter, addActorAt, addActorBefore, clear, findActor, getChildren, hasChildren, isTransform, localToDescendantCoordinates, print, setCullingArea, setTransform, swapActor, swapActor |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Table()
public Table(Skin skin)
add(String)
and add(String, String)
methods to be used.
Method Detail |
---|
public void draw(Batch batch, float parentAlpha)
WidgetGroup
WidgetGroup.validate()
should be called to ensure the widget group is laid
out.
draw
in class WidgetGroup
parentAlpha
- Should be multiplied with the actor's alpha, allowing a parent's alpha to affect all children.public void invalidate()
Layout
Layout.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 Layout
invalidate
in class WidgetGroup
public float getPrefWidth()
getPrefWidth
in interface Layout
getPrefWidth
in class WidgetGroup
public float getPrefHeight()
getPrefHeight
in interface Layout
getPrefHeight
in class WidgetGroup
public float getMinWidth()
getMinWidth
in interface Layout
getMinWidth
in class WidgetGroup
public float getMinHeight()
getMinHeight
in interface Layout
getMinHeight
in class WidgetGroup
public void setBackground(String drawableName)
Table(Skin)
or setSkin(Skin)
was used.
setBackground(Drawable, boolean)
public void setBackground(Drawable background)
setBackground(Drawable, boolean)
public void setBackground(Drawable background, boolean adjustPadding)
Drawable.getBottomHeight()
,
Drawable.getTopHeight()
, Drawable.getLeftWidth()
, and Drawable.getRightWidth()
.
background
- If null, the background will be cleared and padding removed.public Table background(Drawable background)
setBackground(Drawable)
public Table background(String drawableName)
setBackground(String)
public Drawable getBackground()
public Actor hit(float x, float y, boolean touchable)
Actor
touchable
and
visible
, or null if no actor was hit. The point is specified in the actor's local coordinate system (0,0
is the bottom left of the actor and width,height is the upper right).
This method is used to delegate touchDown, mouse, and enter/exit events. If this method returns null, those events will not occur on this Actor.
The default implementation returns this actor if the point is within this actor's bounds.
hit
in class Group
touchable
- If true, the hit detection will respect the touchability
.Touchable
public void setClip(boolean enabled)
Group.setTransform(boolean)
to true.
public boolean getClip()
public int getRow(float y)
public void clearChildren()
clearChildren
in class Group
public Cell<Label> add(String text)
Table(Skin)
or setSkin(Skin)
was used.
public Cell<Label> add(String text, String labelStyleName)
Table(Skin)
or setSkin(Skin)
was used.
public Cell<Label> add(String text, String fontName, Color color)
Table(Skin)
or setSkin(Skin)
was used.
public Cell<Label> add(String text, String fontName, String colorName)
Table(Skin)
or setSkin(Skin)
was used.
public Cell<Actor> add()
public <T extends Actor> Cell<T> add(T actor)
actor
- May be null to add a cell without an actor.public void add(Actor... actors)
public boolean removeActor(Actor actor)
Group
cleared
so the actions will be returned to their
pool
, if any. This is not done automatically.
removeActor
in class Group
public Cell<Stack> stack(Actor... actors)
Stack
.
actors
- May be null to add a stack without any actors.public Cell row()
public Cell columnDefaults(int column)
public Cell defaults()
public void layout()
Layout
Layout.invalidate()
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.
layout
in interface Layout
layout
in class WidgetGroup
public void reset()
clearChildren()
) and additionally resets all table properties
and cell, column, and row defaults.
public <T extends Actor> Cell<T> getCell(T actor)
public List<Cell> getCells()
public Table pad(Value pad)
public Table pad(Value top, Value left, Value bottom, Value right)
public Table padTop(Value padTop)
public Table padLeft(Value padLeft)
public Table padBottom(Value padBottom)
public Table padRight(Value padRight)
public Table pad(float pad)
public Table pad(float top, float left, float bottom, float right)
public Table padTop(float padTop)
public Table padLeft(float padLeft)
public Table padBottom(float padBottom)
public Table padRight(float padRight)
public Table align(int align)
Align.center
, Align.top
,
Align.bottom
, Align.left
, Align.right
, or any combination of those.
public Table center()
Align.center
. This clears any other alignment.
public Table top()
Align.top
and clears Align.bottom
for the alignment of the logical table within the table widget.
public Table left()
Align.left
and clears Align.right
for the alignment of the logical table within the table widget.
public Table bottom()
Align.bottom
and clears Align.top
for the alignment of the logical table within the table widget.
public Table right()
Align.right
and clears Align.left
for the alignment of the logical table within the table widget.
public Table debug()
public Table debugTable()
public Table debugCell()
public Table debugWidget()
public Table debug(BaseTableLayout.Debug debug)
public BaseTableLayout.Debug getDebug()
public Value getPadTopValue()
public float getPadTop()
public Value getPadLeftValue()
public float getPadLeft()
public Value getPadBottomValue()
public float getPadBottom()
public Value getPadRightValue()
public float getPadRight()
public float getPadX()
getPadLeft()
plus getPadRight()
.
public float getPadY()
getPadTop()
plus getPadBottom()
.
public int getAlign()
public void setSkin(Skin skin)
public void setRound(boolean round)
public static void drawDebug(Stage stage)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |