APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.scenes.scene2d.ui

public Class Container<T extends Actor>

extends WidgetGroup
Class Inheritance
Imports
com.badlogic.gdx.graphics.Color, com.badlogic.gdx.graphics.g2d.Batch, com.badlogic.gdx.graphics.glutils.ShapeRenderer, com.badlogic.gdx.math.Rectangle, com.badlogic.gdx.scenes.scene2d.Actor, .Touchable, com.badlogic.gdx.scenes.scene2d.ui.Value.Fixed, com.badlogic.gdx.scenes.scene2d.utils.Cullable, .Drawable, .Layout, com.badlogic.gdx.utils.Align, .Null

A group with a single child that sizes and positions the child using constraints. This provides layout similar to a Table with a single cell but is more lightweight.
Author
Nathan Sweet

Field Summary

Modifier and TypeField and Description
private T
private Rectangle
private int
private Drawable
private boolean
private float
private float
private Value
private Value
private Value
private Value
private Value
private Value
private Value
private Value
private Value
private Value
private boolean

Constructor Summary

AccessConstructor and Description
public
Container()

Creates a container with no actor.

public
Container(T actor)

Method Summary

Modifier and TypeMethod and Description
public void
addActor(Actor actor)

Overrides com.badlogic.gdx.scenes.scene2d.Group.addActor.

Deprecated Container may have only a single child.

Adds an actor as a child of this group, removing it from its previous parent.

public void
addActorAfter(Actor actorAfter, Actor actor)

Overrides com.badlogic.gdx.scenes.scene2d.Group.addActorAfter.

Deprecated Container may have only a single child.

Adds an actor as a child of this group immediately after another child actor, removing it from its previous parent.

public void
addActorAt(int index, Actor actor)

Overrides com.badlogic.gdx.scenes.scene2d.Group.addActorAt.

Deprecated Container may have only a single child.

Adds an actor as a child of this group at a specific index, removing it from its previous parent.

public void
addActorBefore(Actor actorBefore, Actor actor)

Overrides com.badlogic.gdx.scenes.scene2d.Group.addActorBefore.

Deprecated Container may have only a single child.

Adds an actor as a child of this group immediately before another child actor, removing it from its previous parent.

public Container<T>
align(int align)

Sets the alignment of the actor within the container.

public Container<T>
background(Drawable background)

public Container<T>
bottom()

Sets Align#bottom and clears Align#top for the alignment of the actor within the container.

public Container<T>
center()

Sets the alignment of the actor within the container to Align#center.

public Container<T>
clip()

Sets clip to true.

public Container<T>
clip(boolean enabled)

public void
draw(Batch batch, float parentAlpha)

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.draw.

If this method is overridden, the super method or validate() should be called to ensure the widget group is laid out.

protected void
drawBackground(Batch batch, float parentAlpha, float x, float y)

Called to draw the background, before clipping is applied (if enabled).

public void
drawDebug(ShapeRenderer shapes)

Overrides com.badlogic.gdx.scenes.scene2d.Group.drawDebug.

Draws this actor's debug lines if getDebug() is true and, regardless of getDebug(), calls Actor#drawDebug(ShapeRenderer) on each child.

public Container<T>
fill()

Sets fillX and fillY to 1.

public Container<T>
fill(float x, float y)

public Container<T>
fill(boolean x, boolean y)

Sets fillX and fillY to 1 if true, 0 if false.

public Container<T>
fill(boolean fill)

Sets fillX and fillY to 1 if true, 0 if false.

public Container<T>
fillX()

Sets fillX to 1.

public Container<T>
fillY()

Sets fillY to 1.

public T
getActor()

Returns: May be null.

public int
public Drawable
public boolean
public float
public float
public float
public Value
public float
public Value
public float
public Value
public float
public float
public Value
public float
public Value
public float
public Value
public float
public Value
public float
public float
public float
public Value
public float
public Value
public Container<T>
height(Value height)

Sets the minHeight, prefHeight, and maxHeight to the specified value.

public Container<T>
height(float height)

Sets the minHeight, prefHeight, and maxHeight to the specified value.

public Actor
hit(float x, float y, boolean touchable)

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.hit.

If this method is overridden, the super method or validate() should be called to ensure the widget group is laid out.

public void
layout()

Overrides com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup.layout.

Implements com.badlogic.gdx.scenes.scene2d.utils.Layout.layout.

Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child, calls invalidate() on any each child whose width or height has changed, and calls validate() on each child.

public Container<T>
left()

Sets Align#left and clears Align#right for the alignment of the actor within the container.

public Container<T>
maxHeight(Value maxHeight)

public Container<T>
maxHeight(float maxHeight)

public Container<T>
maxSize(Value size)

Sets the maxWidth and maxHeight to the specified value.

public Container<T>
maxSize(Value width, Value height)

Sets the maxWidth and maxHeight to the specified values.

public Container<T>
maxSize(float size)

Sets the maxWidth and maxHeight to the specified value.

public Container<T>
maxSize(float width, float height)

Sets the maxWidth and maxHeight to the specified values.

public Container<T>
maxWidth(Value maxWidth)

public Container<T>
maxWidth(float maxWidth)

public Container<T>
minHeight(Value minHeight)

public Container<T>
minHeight(float minHeight)

public Container<T>
minSize(Value size)

Sets the minWidth and minHeight to the specified value.

public Container<T>
minSize(Value width, Value height)

Sets the minWidth and minHeight to the specified values.

public Container<T>
minSize(float size)

Sets the minWidth and minHeight to the specified value.

public Container<T>
minSize(float width, float height)

Sets the minWidth and minHeight to the specified values.

public Container<T>
minWidth(Value minWidth)

public Container<T>
minWidth(float minWidth)

public Container<T>
pad(Value pad)

Sets the padTop, padLeft, padBottom, and padRight to the specified value.

public Container<T>
pad(Value top, Value left, Value bottom, Value right)

public Container<T>
pad(float pad)

Sets the padTop, padLeft, padBottom, and padRight to the specified value.

public Container<T>
pad(float top, float left, float bottom, float right)

public Container<T>
padBottom(Value padBottom)

public Container<T>
padBottom(float padBottom)

public Container<T>
padLeft(Value padLeft)

public Container<T>
padLeft(float padLeft)

public Container<T>
padRight(Value padRight)

public Container<T>
padRight(float padRight)

public Container<T>
padTop(Value padTop)

public Container<T>
padTop(float padTop)

public Container<T>
prefHeight(Value prefHeight)

public Container<T>
prefHeight(float prefHeight)

public Container<T>
prefSize(Value size)

Sets the prefWidth and prefHeight to the specified value.

public Container<T>
prefSize(Value width, Value height)

Sets the prefWidth and prefHeight to the specified values.

public Container<T>
prefSize(float width, float height)

Sets the prefWidth and prefHeight to the specified value.

public Container<T>
prefSize(float size)

Sets the prefWidth and prefHeight to the specified values.

public Container<T>
prefWidth(Value prefWidth)

public Container<T>
prefWidth(float prefWidth)

public boolean
removeActor(Actor actor)

Overrides com.badlogic.gdx.scenes.scene2d.Group.removeActor.

Removes an actor from this group and unfocuses it.

public boolean
removeActor(Actor actor, boolean unfocus)

Overrides com.badlogic.gdx.scenes.scene2d.Group.removeActor.

Removes an actor from this group.

public Actor
removeActorAt(int index, boolean unfocus)

Overrides com.badlogic.gdx.scenes.scene2d.Group.removeActorAt.

Removes an actor from this group.

public Container<T>
right()

Sets Align#right and clears Align#left for the alignment of the actor within the container.

public void
setActor(T
May be null.
actor
)

public void
setBackground(Drawable background)

Sets the background drawable and adjusts the container's padding to match the background.

public void
setBackground(Drawable
If null, the background will be cleared and padding removed.
background
,
boolean adjustPadding)

Sets the background drawable and, if adjustPadding is true, sets the container's padding to Drawable#getBottomHeight() , Drawable#getTopHeight(), Drawable#getLeftWidth(), and Drawable#getRightWidth().

public void
setClip(boolean enabled)

Causes the contents to be clipped if they exceed the container bounds.

public void
setCullingArea(Rectangle cullingArea)

Overrides com.badlogic.gdx.scenes.scene2d.Group.setCullingArea.

Implements com.badlogic.gdx.scenes.scene2d.utils.Cullable.setCullingArea.

Children completely outside of this rectangle will not be drawn.

public void
setRound(boolean round)

If true (the default), positions and sizes are rounded to integers.

public Container<T>
size(Value size)

Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified value.

public Container<T>
size(Value width, Value height)

Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified values.

public Container<T>
size(float size)

Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified value.

public Container<T>
size(float width, float height)

Sets the minWidth, prefWidth, maxWidth, minHeight, prefHeight, and maxHeight to the specified values.

public Container<T>
top()

Sets Align#top and clears Align#bottom for the alignment of the actor within the container.

public Container<T>
width(Value width)

Sets the minWidth, prefWidth, and maxWidth to the specified value.

public Container<T>
width(float width)

Sets the minWidth, prefWidth, and maxWidth to the specified value.

Inherited from com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup:
childrenChangedinvalidateinvalidateHierarchyneedsLayoutpacksetFillParentsetLayoutEnabledsizeChangedvalidate