public class ImageButton extends ImageWidget
| Modifier and Type | Field and Description | 
|---|---|
| static int | ACTIVEActive state. | 
NO_CONSTRAINT| Constructor and Description | 
|---|
| ImageButton(String imagePath)Creates an image button with the resource path of the image to display. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | handleClick()Handles a click event. | 
| boolean | handleEvent(int event)Handles the given event. | 
| boolean | isInState(int state)Gets whether or not the widget is in the given state. | 
| void | setOnClickListener(OnClickListener listener)Sets the listener on the click events of this button. | 
computeContentOptimalSize, onAttached, onDetached, renderContent, setImagePathaddClassSelector, contains, containsWidget, getAbsoluteX, getAbsoluteY, getContentBounds, getDesktop, getHeight, getParent, getStyle, getWidgetAt, getWidth, getX, getY, hasClassSelector, isAttached, isEnabled, isShown, isTransparent, onHidden, onLaidOut, onShown, removeAllClassSelectors, removeClassSelector, render, requestLayOut, requestRender, requestRender, setClassSelectors, setEnabled, setPosition, setStyle, updateStylepublic static final int ACTIVE
public ImageButton(String imagePath)
imagePath - the resource path of the image to display.public void handleClick()
public boolean handleEvent(int event)
Widgetfalse (does not consume event).
 Called by the desktop event manager.
handleEvent in class Widgetevent - the event to handle.true if the widget has consumed the event, false otherwise.public boolean isInState(int state)
Widgetpublic void setOnClickListener(@Nullable OnClickListener listener)
listener - the listener to set.