libgdx API

com.badlogic.gdx.scenes.scene2d.ui
Class Pane

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
              extended by com.badlogic.gdx.scenes.scene2d.ui.Pane
All Implemented Interfaces:
Layout

public class Pane
extends Table

A Table with a background NinePatch.

Functionality

A Pane is a Table displaying a background NinePatch. It can house multiple Actor instances in a table-layout. The difference to a pure Table is that the Pane will automatically set the padding of the layout to respect the width and height of the border patches of its background NinePatch. See Table for more information on how Actor instances are laid out when using this class.

In addition to the basic functionality provided by the Table super class, a Pane will also employ scissoring (clipping) to ensure that no contained Actor can render outside of its bounds.

Layout

The (preferred) width and height are determined by the values given in the constructor of this class. Please consult the Table documentation on how the width and height will be manipulated if the Pane is contained in another Table. Additionally you can set the (preferred) width and height via a call to TableLayout#size(int, int).

Style

A Pane is a Table displaying a background NinePatch and its child Actors, clipped to the Pane's area, taking into account the padding as described in the functionality section. The style is defined via an instance of Pane.PaneStyle, which can be either done programmatically or via a Skin.

A Pane's style definition in a skin XML file should look like this:
 <pane name="name" 
          background="backgroundPatch"/>
 
 

Author:
mzechner

Nested Class Summary
static class Pane.PaneStyle
          Defines the style of a pane, see Pane
 
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
Pane(Stage stage, Pane.PaneStyle style)
           
Pane(Stage stage, Skin skin)
           
Pane(java.lang.String name, Stage stage, Pane.PaneStyle style, int prefWidth, int prefHeight)
          Creates a new Pane.
 
Method Summary
 void draw(SpriteBatch batch, float parentAlpha)
          Draws the Actor.
 void setStyle(Pane.PaneStyle style)
          Sets the style of this widget.
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.tablelayout.Table
add, align, align, bottom, center, clear, columnDefaults, debug, debug, debug, defaults, drawDebug, getAlign, getAllCells, getAllCells, getCell, getCell, getCells, getDebug, getHeight, getMinHeight, getMinWidth, getPadBottom, getPadLeft, getPadRight, getPadTop, getPrefHeight, getPrefWidth, getTableLayout, height, height, invalidate, invalidateHierarchy, layout, left, pad, pad, pad, pad, padBottom, padBottom, padLeft, padLeft, padRight, padRight, padTop, padTop, parse, reset, right, row, setActor, size, size, stack, top, width, width
 
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

Pane

public Pane(Stage stage,
            Skin skin)

Pane

public Pane(Stage stage,
            Pane.PaneStyle style)

Pane

public Pane(java.lang.String name,
            Stage stage,
            Pane.PaneStyle style,
            int prefWidth,
            int prefHeight)
Creates a new Pane. The width and height are determined by the arguments passed to the constructor.

Parameters:
name - the name
stage - the stage used for clipping
prefWidth - the width
prefHeight - the height
style - the Pane.PaneStyle
Method Detail

setStyle

public void setStyle(Pane.PaneStyle style)
Sets the style of this widget. Calls Table.invalidateHierarchy() internally.

Parameters:
style -

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 Table
Parameters:
batch - the spritebatch to render with
parentAlpha - the parent's alpha value.

libgdx API

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