public class ButtonImage extends Image implements GenericListener
Image
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
ButtonImage()
Creates a button image without source.
|
ButtonImage(ej.microui.display.Image source)
Creates a button image with the source to display.
|
ButtonImage(java.lang.String source)
Creates a button image with the path to the source to display.
|
Modifier and Type | Method and Description |
---|---|
void |
addOnClickListener(OnClickListener listener)
Adds a listener on the click events of the button.
|
boolean |
handleEvent(int event)
Called by the system if the widget is the owner of the focus of the active panel.
|
boolean |
isInState(State state)
Gets whether or not the element is in the given state.
|
void |
performClick()
Performs the actions associated to a click.
|
void |
removeOnClickListener(OnClickListener listener)
Removes a listener on the click events of the button.
|
void |
update()
Something has changed.
|
getSource, renderContent, setSource, setSource, updateSource, updateSource, validateContent
addClassSelector, contains, gainFocus, getAttribute, getChild, getChildrenCount, getChildrenElements, getContentBounds, getParentElement, getStyle, hasClassSelector, isTransparent, lostFocus, mergeStyle, removeAllClassSelectors, removeClassSelector, removeInstanceStyle, render, setClassSelectors, setEnabled, updateStyle, updateStyleOnly, validate
getAbsoluteX, getAbsoluteX, getAbsoluteY, getAbsoluteY, getEventHandler, getHeight, getPanel, getParent, getPreferredHeight, getPreferredWidth, getRelativeX, getRelativeY, getWidgetAt, getWidth, getX, getY, hasFocus, hideNotify, invalidate, isEnabled, isShown, isValid, isVisible, repaint, repaint, requestFocus, requestFocus, revalidate, revalidateSubTree, setBounds, setEventHandler, setLocation, setPreferredSize, setSize, setVisible, showNotify
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEventHandler, getHeight, getWidth, getX, getY, hideNotify, isShown, repaint, repaint, setEventHandler, showNotify
public ButtonImage()
public ButtonImage(java.lang.String source)
source
- the path to the source to display.java.lang.NullPointerException
- if the given source is null
.public ButtonImage(ej.microui.display.Image source)
source
- the source to display.public void update()
GenericListener
update
in interface GenericListener
public void performClick()
public void addOnClickListener(OnClickListener listener)
listener
- the listener to add.java.lang.NullPointerException
- if the given listener is null
.public void removeOnClickListener(OnClickListener listener)
listener
- the listener to remove.public boolean isInState(State state)
Element
isInState
in interface Element
isInState
in class StyledWidget
state
- the state to check.true
if the element is in the given state, false
otherwise.public boolean handleEvent(int event)
Widget
If an event handler is registered, its EventHandler#handleEvent(int)
method is called.
Otherwise, do nothing and return false
(do not consume event).
handleEvent
in interface Renderable
handleEvent
in class Widget
event
- the event to handle.true
if the widget has consumed the event, false
otherwise.Widget.setEventHandler(EventHandler)