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

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.WidgetGroup
              extended by com.badlogic.gdx.scenes.scene2d.ui.Table
                  extended by com.badlogic.gdx.scenes.scene2d.ui.Button
                      extended by com.badlogic.gdx.scenes.scene2d.ui.ImageButton
All Implemented Interfaces:
Cullable, Disableable, Layout

public class ImageButton
extends Button

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 Class Summary
static class ImageButton.ImageButtonStyle
          The style for an image button, see ImageButton.
 
Nested classes/interfaces inherited from class com.badlogic.gdx.scenes.scene2d.ui.Button
Button.ButtonStyle
 
Constructor Summary
ImageButton(Drawable imageUp)
           
ImageButton(Drawable imageUp, Drawable imageDown)
           
ImageButton(Drawable imageUp, Drawable imageDown, Drawable imageChecked)
           
ImageButton(ImageButton.ImageButtonStyle style)
           
ImageButton(Skin skin)
           
ImageButton(Skin skin, String styleName)
           
 
Method Summary
 void draw(SpriteBatch batch, float parentAlpha)
          If this method is overridden, the super method or WidgetGroup.validate() should be called to ensure the widget group is laid out.
 Image getImage()
           
 Cell getImageCell()
           
 ImageButton.ImageButtonStyle getStyle()
          Returns the button's style.
 void setStyle(Button.ButtonStyle style)
           
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Button
getClickListener, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, isChecked, isDisabled, isOver, isPressed, setChecked, setDisabled, toggle
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Table
add, add, add, add, add, add, align, bottom, center, clearChildren, columnDefaults, debug, debug, debugCell, debugTable, debugWidget, defaults, drawDebug, getAlign, getBackground, getCell, getCells, getClip, getDebug, getPadBottom, getPadBottomValue, getPadLeft, getPadLeftValue, getPadRight, getPadRightValue, getPadTop, getPadTopValue, getPadX, getPadY, getRow, hit, invalidate, layout, left, pad, pad, pad, pad, padBottom, padBottom, padLeft, padLeft, padRight, padRight, padTop, padTop, removeActor, reset, right, row, setBackground, setBackground, setClip, setRound, setSkin, stack, top
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup
getMaxHeight, getMaxWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, validate
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Group
act, addActor, addActorAfter, addActorAt, addActorBefore, clear, findActor, getChildren, hasChildren, isTransform, localToDescendantCoordinates, print, setCullingArea, setTransform, swapActor, swapActor
 
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor
addAction, addCaptureListener, addListener, clearActions, clearListeners, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageButton

public ImageButton(Skin skin)

ImageButton

public ImageButton(Skin skin,
                   String styleName)

ImageButton

public ImageButton(ImageButton.ImageButtonStyle style)

ImageButton

public ImageButton(Drawable imageUp)

ImageButton

public ImageButton(Drawable imageUp,
                   Drawable imageDown)

ImageButton

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

setStyle

public void setStyle(Button.ButtonStyle style)
Overrides:
setStyle in class Button

getStyle

public ImageButton.ImageButtonStyle getStyle()
Description copied from class: Button
Returns the button's style. Modifying the returned style may not have an effect until Button.setStyle(ButtonStyle) is called.

Overrides:
getStyle in class Button

draw

public void draw(SpriteBatch batch,
                 float parentAlpha)
Description copied from class: WidgetGroup
If this method is overridden, the super method or WidgetGroup.validate() should be called to ensure the widget group is laid out.

Overrides:
draw in class Button
parentAlpha - Should be multiplied with the actor's alpha, allowing a parent's alpha to affect all children.

getImage

public Image getImage()

getImageCell

public Cell getImageCell()


Copyright © 2013. All Rights Reserved.