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

public Class ImageTextButton

extends Button
Class Inheritance
Imports
com.badlogic.gdx.graphics.Color, com.badlogic.gdx.graphics.g2d.Batch, .BitmapFont, com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle, .TextButton.TextButtonStyle, com.badlogic.gdx.scenes.scene2d.utils.Drawable, com.badlogic.gdx.utils.Align, .Null, .Scaling

A button with a child Image and Label.
Author
Nathan Sweet
See Also
ImageButton, TextButton, Button

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ImageTextButton.ImageTextButtonStyle

The style for an image text button, see ImageTextButton.

Field Summary

Modifier and TypeField and Description
private final Image
private Label
private ImageTextButton.ImageTextButtonStyle
Inherited from com.badlogic.gdx.scenes.scene2d.ui.Button:
buttonGroupisCheckedisDisabled

Constructor Summary

AccessConstructor and Description
public
public
ImageTextButton(String text, Skin skin, String styleName)

public

Method Summary

Modifier and TypeMethod and Description
public void
draw(Batch batch, float parentAlpha)

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

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

protected Color
getFontColor()

Returns the appropriate label font color from the style based on the current button state.

public Image
public Cell<T extends Actor>
protected Drawable
getImageDrawable()

Returns the appropriate image drawable from the style based on the current button state.

public Label
public Cell<T extends Actor>
public ImageTextButton.ImageTextButtonStyle
public CharSequence
protected Image
protected Label
public void
setLabel(Label label)

public void
public void
public String
toString()

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

Returns a description of the actor hierarchy, recursively.

protected void
updateImage()

Sets the image drawable based on the current button state.

Inherited from com.badlogic.gdx.scenes.scene2d.ui.Button:
getBackgroundDrawablegetButtonGroupgetClickListenergetMinHeightgetMinWidthgetPrefHeightgetPrefWidthgetProgrammaticChangeEventsisCheckedisDisabledisOverisPressedsetCheckedsetCheckedsetDisabledsetProgrammaticChangeEventstoggle

Field Detail

imageback to summary
private final Image image
labelback to summary
private Label label
styleback to summary
private ImageTextButton.ImageTextButtonStyle style

Hides com.badlogic.gdx.scenes.scene2d.ui.Button.style.

Constructor Detail

ImageTextButtonback to summary
public ImageTextButton(String text, Skin skin)
ImageTextButtonback to summary
public ImageTextButton(String text, Skin skin, String styleName)
ImageTextButtonback to summary
public ImageTextButton(String text, ImageTextButton.ImageTextButtonStyle style)

Method Detail

drawback to summary
public void draw(Batch batch, float parentAlpha)

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

Doc from 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.

getFontColorback to summary
protected Color getFontColor()

Returns the appropriate label font color from the style based on the current button state.

Annotations
@Null
getImageback to summary
public Image getImage()
getImageCellback to summary
public Cell<T extends Actor> getImageCell()
getImageDrawableback to summary
protected Drawable getImageDrawable()

Returns the appropriate image drawable from the style based on the current button state.

Annotations
@Null
getLabelback to summary
public Label getLabel()
getLabelCellback to summary
public Cell<T extends Actor> getLabelCell()
getStyleback to summary
public ImageTextButton.ImageTextButtonStyle getStyle()

Overrides com.badlogic.gdx.scenes.scene2d.ui.Button.getStyle.

Implements com.badlogic.gdx.scenes.scene2d.ui.Styleable.getStyle.

Doc from com.badlogic.gdx.scenes.scene2d.ui.Button.getStyle.

Returns the button's style. Modifying the returned style may not have an effect until setStyle(ButtonStyle) is called.

getTextback to summary
public CharSequence getText()
newImageback to summary
protected Image newImage()
newLabelback to summary
protected Label newLabel(String text, Label.LabelStyle style)
setLabelback to summary
public void setLabel(Label label)
setStyleback to summary
public void setStyle(Button.ButtonStyle style)

Overrides com.badlogic.gdx.scenes.scene2d.ui.Button.setStyle.

Implements com.badlogic.gdx.scenes.scene2d.ui.Styleable.setStyle.

Doc from com.badlogic.gdx.scenes.scene2d.ui.Styleable.setStyle.

Set the current style of the actor

setTextback to summary
public void setText(CharSequence text)
toStringback to summary
public String toString()

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

Doc from com.badlogic.gdx.scenes.scene2d.Group.toString.

Returns a description of the actor hierarchy, recursively.

updateImageback to summary
protected void updateImage()

Sets the image drawable based on the current button state. The default implementation sets the image drawable using getImageDrawable().

com.badlogic.gdx.scenes.scene2d.ui back to summary

public Class ImageTextButton.ImageTextButtonStyle

extends TextButtonStyle
Class Inheritance

The style for an image text button, see ImageTextButton.
Author
Nathan Sweet

Field Summary

Modifier and TypeField and Description
public Drawable
public Drawable
public Drawable
public Drawable
public Drawable
public Drawable
public Drawable
Inherited from com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle:
checkedDownFontColorcheckedFocusedFontColorcheckedFontColorcheckedOverFontColordisabledFontColordownFontColorfocusedFontColorfontfontColoroverFontColor

Constructor Summary

AccessConstructor and Description
public
public
public
public

Field Detail

imageCheckedback to summary
public Drawable imageChecked
Annotations
@Null
imageCheckedDownback to summary
public Drawable imageCheckedDown
Annotations
@Null
imageCheckedOverback to summary
public Drawable imageCheckedOver
Annotations
@Null
imageDisabledback to summary
public Drawable imageDisabled
Annotations
@Null
imageDownback to summary
public Drawable imageDown
Annotations
@Null
imageOverback to summary
public Drawable imageOver
Annotations
@Null
imageUpback to summary
public Drawable imageUp
Annotations
@Null

Constructor Detail

ImageTextButtonStyleback to summary
public ImageTextButtonStyle()
ImageTextButtonStyleback to summary
public ImageTextButtonStyle(Drawable up, Drawable down, Drawable checked, BitmapFont font)
ImageTextButtonStyleback to summary
public ImageTextButtonStyle(ImageTextButton.ImageTextButtonStyle style)
ImageTextButtonStyleback to summary
public ImageTextButtonStyle(TextButton.TextButtonStyle style)