libgdx API

com.badlogic.gdx.scenes.scene2d.ui.tablelayout
Class Table

java.lang.Object
  extended by com.badlogic.gdx.scenes.scene2d.Actor
      extended by com.badlogic.gdx.scenes.scene2d.Group
          extended by com.badlogic.gdx.scenes.scene2d.ui.tablelayout.Table
All Implemented Interfaces:
Layout
Direct Known Subclasses:
Pane, Window

public class Table
extends Group
implements Layout

Author:
Nathan Sweet

Field Summary
 
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Group
batchTransform, children, debug, debugTexture, focusedActor, groups, immutableChildren, immutableGroups, keyboardFocusedActor, lastTouchedChild, localTransform, namesToActors, oldBatchTransform, scrollFocusedActor, transform, worldTransform
 
Fields inherited from class com.badlogic.gdx.scenes.scene2d.Actor
actions, color, height, name, originX, originY, parent, rotation, scaleX, scaleY, touchable, visible, width, x, y
 
Constructor Summary
Table()
           
Table(float width, float height)
           
Table(java.lang.String name)
           
Table(java.lang.String name, float width, float height)
           
Table(java.lang.String name, TableLayout layout)
           
Table(TableLayout layout)
           
 
Method Summary
 Cell add(Actor actor)
          Adds a new cell to the table with the specified actor.
 Table align(int align)
          Alignment of the table within the actor being laid out.
 Table align(java.lang.String value)
          Alignment of the table within the actor being laid out.
 Table bottom()
          Sets the alignment of the table within the actor being laid out to #BOTTOM.
 Table center()
          Sets the alignment of the table within the actor being laid out to #CENTER.
 void clear()
          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(int debug)
          Turns on debug lines.
 Table debug(java.lang.String value)
          Turns on debug lines.
 Cell defaults()
          The cell values that will be used as the defaults for all cells.
 void draw(SpriteBatch batch, float parentAlpha)
          Draws the Actor.
static void drawDebug(Stage stage)
          Draws the debug lines for all TableLayouts in the stage.
 int getAlign()
           
 java.util.List<Cell> getAllCells()
          Returns all cells, anywhere in the table hierarchy.
 java.util.List<Cell> getAllCells(java.lang.String namePrefix)
          Returns all cells with the specified name prefix, anywhere in the table hierarchy.
 Cell getCell(Actor actor)
          Returns the cell for the specified actor, anywhere in the table hierarchy.
 Cell getCell(java.lang.String name)
          Returns the cell with the specified name, anywhere in the table hierarchy.
 java.util.List<Cell> getCells()
          Returns the cells for this table.
 int getDebug()
           
 java.lang.String getHeight()
           
 int getMinHeight()
          The minimum size of the table.
 int getMinWidth()
          The minimum width of the table.
 java.lang.String getPadBottom()
           
 java.lang.String getPadLeft()
           
 java.lang.String getPadRight()
           
 java.lang.String getPadTop()
           
 float getPrefHeight()
           
 float getPrefWidth()
           
 TableLayout getTableLayout()
           
 Table height(int height)
          The fixed height of the table.
 Table height(java.lang.String height)
          The fixed height of the table, or null.
 void invalidate()
          Invalidates the layout, forcing the next call to Layout.layout() to relayout.
 void invalidateHierarchy()
          Invalides the layout of this actor and every parent actor to the root of the hierarchy.
 void layout()
          Positions and sizes children of the actor being laid out using the cell associated with each child.
 Table left()
          Sets the alignment of the table within the actor being laid out to #LEFT.
 Table pad(int pad)
          Padding around the table.
 Table pad(int top, int left, int bottom, int right)
          Padding around the table.
 Table pad(java.lang.String pad)
          Padding around the table.
 Table pad(java.lang.String top, java.lang.String left, java.lang.String bottom, java.lang.String right)
          Padding around the table.
 Table padBottom(int padBottom)
          Padding at the bottom of the table.
 Table padBottom(java.lang.String padBottom)
          Padding at the bottom of the table.
 Table padLeft(int padLeft)
          Padding at the left of the table.
 Table padLeft(java.lang.String padLeft)
          Padding at the left of the table.
 Table padRight(int padRight)
          Padding at the right of the table.
 Table padRight(java.lang.String padRight)
          Padding at the right of the table.
 Table padTop(int padTop)
          Padding at the top of the table.
 Table padTop(java.lang.String padTop)
          Padding at the top of the table.
 void parse(java.lang.String tableDescription)
          Parses a table description and adds the actors and cells to the table.
 void reset()
          Removes all actors and cells from the table (same as clear()) and additionally resets all table properties and cell, column, and row defaults.
 Table right()
          Sets the alignment of the table within the actor being laid out to #RIGHT.
 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 setActor(java.lang.String name, Actor actor)
          Sets the actor in the cell with the specified name.
 Table size(int width, int height)
          The fixed size of the table.
 Table size(java.lang.String width, java.lang.String height)
          The fixed size of the table.
 Cell stack(Actor... actor)
          Adds a new cell to the table with the specified actors in a Stack.
 Table top()
          Sets the alignment of the table within the actor being laid out to #TOP.
 Table width(int width)
          The fixed width of the table.
 Table width(java.lang.String width)
          The fixed width of the table, or null.
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group
act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, disableDebugging, drawChild, drawChildren, enableDebugging, findActor, focus, getActors, getGroups, hit, keyboardFocus, keyDown, keyTyped, keyUp, removeActor, removeActorRecursive, resetTransform, scrolled, scrollFocus, sortChildren, swapActor, swapActor, toChildCoordinates, touchDown, touchDragged, touchMoved, touchUp, unfocusAll, unfocusAll, updateTransform
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor
action, clearActions, isMarkedToRemove, markToRemove, remove, toLocalCoordinates, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Table

public Table()

Table

public Table(float width,
             float height)

Table

public Table(TableLayout layout)

Table

public Table(java.lang.String name)

Table

public Table(java.lang.String name,
             float width,
             float height)

Table

public Table(java.lang.String name,
             TableLayout layout)
Method Detail

draw

public void draw(SpriteBatch batch,
                 float parentAlpha)
Description copied from class: Actor
Draws the Actor. The spriteBatch is configured so that the Actor can draw in its parents coordinate system. The parent's alpha is passed to the method in order for the Actor to multiply it with its own alpha. This will allow FadeIn and other Actions to have an effect even if they are only set on the parent of the Actor.

Overrides:
draw in class Group
Parameters:
batch - the spritebatch to render with
parentAlpha - the parent's alpha value.

getPrefWidth

public float getPrefWidth()
Specified by:
getPrefWidth in interface Layout

getPrefHeight

public float getPrefHeight()
Specified by:
getPrefHeight in interface Layout

getTableLayout

public TableLayout getTableLayout()

clear

public void clear()
Removes all actors and cells from the table.

Overrides:
clear in class Group

add

public Cell add(Actor actor)
Adds a new cell to the table with the specified actor.

Parameters:
actor - May be null to add a cell without an actor.
See Also:
TableLayout#add(Actor)

stack

public Cell stack(Actor... actor)
Adds a new cell to the table with the specified actors in a Stack.

Parameters:
actor - May be null to add a cell without an actor.
See Also:
TableLayout#stack(Actor...)

row

public 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.

See Also:
TableLayout#row()

parse

public void parse(java.lang.String tableDescription)
Parses a table description and adds the actors and cells to the table.

See Also:
TableLayout#parse(String)

columnDefaults

public Cell columnDefaults(int column)
Gets the cell values that will be used as the defaults for all cells in the specified column.

See Also:
TableLayout#columnDefaults(int)

defaults

public Cell defaults()
The cell values that will be used as the defaults for all cells.

See Also:
TableLayout#defaults()

layout

public void layout()
Positions and sizes children of the actor being laid out using the cell associated with each child.

Specified by:
layout in interface Layout
See Also:
TableLayout.layout()

invalidate

public void invalidate()
Description copied from interface: Layout
Invalidates the layout, forcing the next call to Layout.layout() to relayout. If an actor is resized or otherwise changed in a way that affects its layout, Layout.invalidate() should be called.

Specified by:
invalidate in interface Layout

invalidateHierarchy

public void invalidateHierarchy()
Invalides the layout of this actor and every parent actor to the root of the hierarchy.

See Also:
TableLayout.invalidateHierarchy()

reset

public void reset()
Removes all actors and cells from the table (same as clear()) and additionally resets all table properties and cell, column, and row defaults.

See Also:
TableLayout#reset()

getCell

public Cell getCell(Actor actor)
Returns the cell for the specified actor, anywhere in the table hierarchy.

See Also:
TableLayout#getCell(Actor)

getCell

public Cell getCell(java.lang.String name)
Returns the cell with the specified name, anywhere in the table hierarchy.

See Also:
TableLayout#getCell(String)

getAllCells

public java.util.List<Cell> getAllCells()
Returns all cells, anywhere in the table hierarchy.

See Also:
TableLayout#getAllCells()

getAllCells

public java.util.List<Cell> getAllCells(java.lang.String namePrefix)
Returns all cells with the specified name prefix, anywhere in the table hierarchy.

See Also:
TableLayout#getAllCells(String)

getCells

public java.util.List<Cell> getCells()
Returns the cells for this table.

See Also:
TableLayout#getCells()

setActor

public void setActor(java.lang.String name,
                     Actor actor)
Sets the actor in the cell with the specified name.

See Also:
TableLayout#setWidget(String, Actor)

getMinWidth

public int getMinWidth()
The minimum width of the table. Available after laying out.

See Also:
TableLayout#getMinWidth()

getMinHeight

public int getMinHeight()
The minimum size of the table. Available after laying out.

See Also:
TableLayout#getMinHeight()

size

public Table size(java.lang.String width,
                  java.lang.String height)
The fixed size of the table.

See Also:
TableLayout#size(String, String)

width

public Table width(java.lang.String width)
The fixed width of the table, or null.

See Also:
TableLayout#width(String)

height

public Table height(java.lang.String height)
The fixed height of the table, or null.

See Also:
TableLayout#height(String)

size

public Table size(int width,
                  int height)
The fixed size of the table.

See Also:
TableLayout#size(int, int)

width

public Table width(int width)
The fixed width of the table.

See Also:
TableLayout#width(int)

height

public Table height(int height)
The fixed height of the table.

See Also:
TableLayout#height(int)

pad

public Table pad(java.lang.String pad)
Padding around the table.

See Also:
TableLayout#pad(String)

pad

public Table pad(java.lang.String top,
                 java.lang.String left,
                 java.lang.String bottom,
                 java.lang.String right)
Padding around the table.

See Also:
TableLayout#pad(String, String, String, String)

padTop

public Table padTop(java.lang.String padTop)
Padding at the top of the table.

See Also:
TableLayout#padTop(String)

padLeft

public Table padLeft(java.lang.String padLeft)
Padding at the left of the table.

See Also:
TableLayout#padLeft(String)

padBottom

public Table padBottom(java.lang.String padBottom)
Padding at the bottom of the table.

See Also:
TableLayout#padBottom(String)

padRight

public Table padRight(java.lang.String padRight)
Padding at the right of the table.

See Also:
TableLayout#padRight(String)

pad

public Table pad(int pad)
Padding around the table.

See Also:
TableLayout#pad(int)

pad

public Table pad(int top,
                 int left,
                 int bottom,
                 int right)
Padding around the table.

See Also:
TableLayout#pad(int, int, int, int)

padTop

public Table padTop(int padTop)
Padding at the top of the table.

See Also:
TableLayout#padTop(int)

padLeft

public Table padLeft(int padLeft)
Padding at the left of the table.

See Also:
TableLayout#padLeft(int)

padBottom

public Table padBottom(int padBottom)
Padding at the bottom of the table.

See Also:
TableLayout#padBottom(int)

padRight

public Table padRight(int padRight)
Padding at the right of the table.

See Also:
TableLayout#padRight(int)

align

public Table align(int align)
Alignment of the table within the actor being laid out. Set to #CENTER, #TOP, #BOTTOM, #LEFT , #RIGHT, or any combination of those.

See Also:
TableLayout#align(int)

align

public Table align(java.lang.String value)
Alignment of the table within the actor being laid out. Set to "center", "top", "bottom", "left", "right", or a string containing any combination of those.

See Also:
TableLayout#align(String)

center

public Table center()
Sets the alignment of the table within the actor being laid out to #CENTER.

See Also:
TableLayout#center()

top

public Table top()
Sets the alignment of the table within the actor being laid out to #TOP.

See Also:
TableLayout#top()

left

public Table left()
Sets the alignment of the table within the actor being laid out to #LEFT.

See Also:
TableLayout#left()

bottom

public Table bottom()
Sets the alignment of the table within the actor being laid out to #BOTTOM.

See Also:
TableLayout#bottom()

right

public Table right()
Sets the alignment of the table within the actor being laid out to #RIGHT.

See Also:
TableLayout#right()

debug

public Table debug()
Turns on all debug lines.

See Also:
TableLayout#debug()

debug

public Table debug(int debug)
Turns on debug lines. Set to , , , , or any combination of those. Set to to disable.

See Also:
TableLayout#debug()

debug

public Table debug(java.lang.String value)
Turns on debug lines. Set to "all", "table", "cell", "widget", or a string containing any combination of those. Set to null to disable.

See Also:
TableLayout#debug(String)

getDebug

public int getDebug()

getHeight

public java.lang.String getHeight()

getPadTop

public java.lang.String getPadTop()

getPadLeft

public java.lang.String getPadLeft()

getPadBottom

public java.lang.String getPadBottom()

getPadRight

public java.lang.String getPadRight()

getAlign

public int getAlign()

drawDebug

public static void drawDebug(Stage stage)
Draws the debug lines for all TableLayouts in the stage. If this method is not called each frame, no debug lines will be drawn.


libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)