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

public Class ImageButton

extends Button
Class Inheritance
Imports
com.badlogic.gdx.graphics.g2d.Batch, com.badlogic.gdx.scenes.scene2d.utils.Drawable, com.badlogic.gdx.utils.Null, .Scaling

A button with a child Image to display an image. This is useful when the button must be larger than the image and the image centered on the button. If the image is the size of the button, a Button without any children can be used, where the Button.ButtonStyle#up, Button.ButtonStyle#down, and Button.ButtonStyle#checked nine patches define the image.
Author
Nathan Sweet

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ImageButton.ImageButtonStyle

The style for an image button, see ImageButton.

Field Summary

Modifier and TypeField and Description
private final Image
private ImageButton.ImageButtonStyle
Inherited from com.badlogic.gdx.scenes.scene2d.ui.Button:
buttonGroupisCheckedisDisabled

Constructor Summary

AccessConstructor and Description
public
public
ImageButton(Skin skin, String styleName)

public
public
public
ImageButton(Drawable imageUp, Drawable imageDown)

public
ImageButton(Drawable imageUp, Drawable imageDown, Drawable imageChecked)

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.

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 ImageButton.ImageButtonStyle
protected Image
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
styleback to summary
private ImageButton.ImageButtonStyle style

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

Constructor Detail

ImageButtonback to summary
public ImageButton(Skin skin)
ImageButtonback to summary
public ImageButton(Skin skin, String styleName)
ImageButtonback to summary
public ImageButton(ImageButton.ImageButtonStyle style)
ImageButtonback to summary
public ImageButton(Drawable imageUp)
ImageButtonback to summary
public ImageButton(Drawable imageUp, Drawable imageDown)
ImageButtonback to summary
public ImageButton(Drawable imageUp, Drawable imageDown, Drawable imageChecked)

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.

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
getStyleback to summary
public ImageButton.ImageButtonStyle 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.

newImageback to summary
protected Image newImage()
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

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 ImageButton.ImageButtonStyle

extends ButtonStyle
Class Inheritance

The style for an image button, see ImageButton.
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.Button.ButtonStyle:
checkedcheckedDowncheckedFocusedcheckedOffsetXcheckedOffsetYcheckedOverdisableddownfocusedoverpressedOffsetXpressedOffsetYunpressedOffsetXunpressedOffsetYup

Constructor Summary

AccessConstructor and Description
public
public
ImageButtonStyle(Drawable up, Drawable down, Drawable checked, Drawable imageUp, Drawable imageDown, Drawable imageChecked)

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

ImageButtonStyleback to summary
public ImageButtonStyle()
ImageButtonStyleback to summary
public ImageButtonStyle(Drawable up, Drawable down, Drawable checked, Drawable imageUp, Drawable imageDown, Drawable imageChecked)
ImageButtonStyleback to summary
public ImageButtonStyle(ImageButton.ImageButtonStyle style)
ImageButtonStyleback to summary
public ImageButtonStyle(Button.ButtonStyle style)