- All Implemented Interfaces:
public abstract class Button extends CompositeWidget implements ClickableThis abstract class represents a general
Clickablecontainer that can contain additional widgets. For example, a rectangular button with text inside it, can be created by adding a
Rectanglewidget and a
Labelwidget into this
Methods Modifier and Type Method and Description
create(short id, XYPair size, XYPair relLocation)Factory method for creating a concrete instance initialized with the specified parameters
getColor()This method is not supported for this widget type and will throw
intersect(XYPair clickLocation)Returns true if this widget intersects with the location of the mouse click, and false othewise.
public static final Button create(short id, XYPair size, XYPair relLocation) throws UiExceptionFactory method for creating a concrete instance initialized with the specified parameters
id- An ID representing this
Widgetfor quick reference by the calling application. The ID does not have to be unique and is not used internally by the package.
size- The size of the
relLocation- The relative location from the parent
UiIllegalParameterException- in one of the following cases:
- Size is negative or 0.
- Location is negative.
- Size exceeds upper bound
- Location exceeds upper bound
public boolean intersect(XYPair clickLocation) throws UiExceptionReturns true if this widget intersects with the location of the mouse click, and false othewise. Note that widget intersection can only be checked after the
Dialogcontaining this widget was rendered.
- Specified by:
clickLocation- The location where the mouse click occurred.
- true if the click intersects with the widget bounding box, false otherwise.
UiNotInitializedException- if the
Dialogcontaining this widget was not rendered yet.
UiIllegalParameterException- if click location is negative or extends
Dialogsize limit: Dialog.DIALOG_MAX_WIDTH or Dialog.DIALOG_MAX_HEIGHT
public int getColor() throws UiExceptionThis method is not supported for this widget type and will throw