|
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.Group
com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
com.badlogic.gdx.scenes.scene2d.ui.Table
com.badlogic.gdx.scenes.scene2d.ui.Window
com.badlogic.gdx.scenes.scene2d.ui.Dialog
public class Dialog
Displays a dialog, which is a modal window containing a content table with a button table underneath it. Methods are provided
to add a label to the content table and buttons to the button table, but any widgets can be added. When a button is clicked,
result(Object)
is called and the dialog is removed from the stage.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.badlogic.gdx.scenes.scene2d.ui.Window |
---|
Window.WindowStyle |
Field Summary | |
---|---|
static float |
fadeDuration
The time in seconds that dialogs will fade in and out. |
Constructor Summary | |
---|---|
Dialog(java.lang.String title,
Skin skin)
|
|
Dialog(java.lang.String title,
Skin skin,
java.lang.String windowStyleName)
|
|
Dialog(java.lang.String title,
Window.WindowStyle windowStyle)
|
Method Summary | |
---|---|
Dialog |
button(Button button)
Adds the given button to the button table. |
Dialog |
button(Button button,
java.lang.Object object)
Adds the given button to the button table. |
Dialog |
button(java.lang.String text)
Adds a text button to the button table. |
Dialog |
button(java.lang.String text,
java.lang.Object object)
Adds a text button to the button table. |
Dialog |
button(java.lang.String text,
java.lang.Object object,
TextButton.TextButtonStyle buttonStyle)
Adds a text button to the button table. |
void |
cancel()
|
Table |
getButtonTable()
|
Table |
getContentTable()
|
void |
hide()
Hides the dialog. |
Dialog |
key(int keycode,
java.lang.Object object)
If this key is pressed, result(Object) is called with the specified object. |
protected void |
result(java.lang.Object object)
Called when a button is clicked. |
void |
setObject(Actor actor,
java.lang.Object object)
|
protected void |
setParent(Group parent)
Called by the framework when an actor is added to or removed from a group. |
Dialog |
show(Stage stage)
Packs the dialog and adds it to the stage, centered. |
Dialog |
text(Label label)
Adds the given Label to the content table |
Dialog |
text(java.lang.String text)
Adds a label to the content table. |
Dialog |
text(java.lang.String text,
Label.LabelStyle labelStyle)
Adds a label to the content table. |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Window |
---|
draw, drawBackground, getPrefWidth, getStyle, getTitle, hit, isDragging, setKeepWithinStage, setModal, setMovable, setStyle, setTitle, setTitleAlignment |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table |
---|
add, add, add, add, add, add, align, bottom, center, clear, columnDefaults, debug, debug, debugCell, debugTable, debugWidget, defaults, drawDebug, getAlign, getBackground, getCell, getCells, getDebug, getMinHeight, getMinWidth, getPadBottom, getPadBottomValue, getPadLeft, getPadLeftValue, getPadRight, getPadRightValue, getPadTop, getPadTopValue, getPadX, getPadY, getPrefHeight, getRow, invalidate, layout, left, pad, pad, padBottom, padLeft, padRight, padTop, reset, right, row, setBackground, setBackground, setClip, setRound, setSkin, stack, top |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup |
---|
childrenChanged, getMaxHeight, getMaxWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, validate |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group |
---|
act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, computeTransform, drawChildren, findActor, getChildren, isTransform, localToDescendantCoordinates, removeActor, resetTransform, setCullingArea, setStage, setTransform, swapActor, swapActor |
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor |
---|
addAction, addCaptureListener, addListener, clearActions, clipBegin, clipBegin, clipEnd, fire, getActions, getCaptureListeners, getColor, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getWidth, getX, getY, getZIndex, hasParent, isAscendantOf, isDescendantOf, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, notify, parentToLocalCoordinates, remove, removeAction, removeCaptureListener, removeListener, rotate, scale, scale, screenToLocalCoordinates, setBounds, setColor, setColor, setHeight, setName, setOrigin, setOriginX, setOriginY, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setVisible, setWidth, setX, setY, setZIndex, size, size, stageToLocalCoordinates, toBack, toFront, toString, translate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static float fadeDuration
Constructor Detail |
---|
public Dialog(java.lang.String title, Skin skin)
public Dialog(java.lang.String title, Skin skin, java.lang.String windowStyleName)
public Dialog(java.lang.String title, Window.WindowStyle windowStyle)
Method Detail |
---|
public Table getContentTable()
public Table getButtonTable()
public Dialog text(java.lang.String text)
public Dialog text(java.lang.String text, Label.LabelStyle labelStyle)
public Dialog text(Label label)
public Dialog button(java.lang.String text)
result(Object)
if this button is clicked. The dialog
must have been constructed with a skin to use this method.
public Dialog button(java.lang.String text, java.lang.Object object)
object
- The object that will be passed to result(Object)
if this button is clicked. May be null.public Dialog button(java.lang.String text, java.lang.Object object, TextButton.TextButtonStyle buttonStyle)
object
- The object that will be passed to result(Object)
if this button is clicked. May be null.public Dialog button(Button button)
public Dialog button(Button button, java.lang.Object object)
object
- The object that will be passed to result(Object)
if this button is clicked. May be null.public Dialog show(Stage stage)
Packs
the dialog and adds it to the stage, centered.
public void hide()
fadeDuration
seconds and then removes it from the stage.
protected void setParent(Group parent)
Actor
setParent
in class Actor
parent
- May be null if the actor has been removed from the parent.public void setObject(Actor actor, java.lang.Object object)
public Dialog key(int keycode, java.lang.Object object)
result(Object)
is called with the specified object.
Input.Keys
protected void result(java.lang.Object object)
cancel()
is called.
object
- The object specified when the button was added.public void cancel()
|
libgdx API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |