com.intel.ui
Class Button
- java.lang.Object
-
- com.intel.ui.Widget
-
- com.intel.ui.CompositeWidget
-
- com.intel.ui.Button
-
- All Implemented Interfaces:
- Clickable
public abstract class Button extends CompositeWidget implements Clickable
This abstract class represents a generalClickable
container that can contain additional widgets. For example, a rectangular button with text inside it, can be created by adding aRectangle
widget and aLabel
widget into thisButton
object.
-
-
Method Summary
Methods Modifier and Type Method and Description static Button
create(short id, XYPair size, XYPair relLocation)
Factory method for creating a concrete instance initialized with the specified parametersint
getColor()
This method is not supported for this widget type and will throwUiNotSupportedException
.boolean
intersect(XYPair clickLocation)
Returns true if this widget intersects with the location of the mouse click, and false othewise.-
Methods inherited from class com.intel.ui.CompositeWidget
addWidget, addWidgets, getWidgets
-
Methods inherited from class com.intel.ui.Widget
getId, getRelativeLocation, getSize
-
-
-
-
Method Detail
-
create
public static final Button create(short id, XYPair size, XYPair relLocation) throws UiException
Factory method for creating a concrete instance initialized with the specified parameters- Parameters:
id
- An ID representing thisWidget
for 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 theWidget
relLocation
- The relative location from the parentWidget
- Returns:
Button
instance- Throws:
UiIllegalParameterException
- in one of the following cases:- Size is negative or 0.
- Location is negative.
- Size exceeds upper bound
Widget.MAX_WIDTH
and/orWidget.MAX_HEIGHT
. - Location exceeds upper bound
Widget.MAX_WIDTH
and/orWidget.MAX_HEIGHT
.
UiException
-
intersect
public boolean intersect(XYPair clickLocation) throws UiException
Returns true if this widget intersects with the location of the mouse click, and false othewise. Note that widget intersection can only be checked after theDialog
containing this widget was rendered.- Specified by:
intersect
in interfaceClickable
- Parameters:
clickLocation
- The location where the mouse click occurred.- Returns:
- true if the click intersects with the widget bounding box, false otherwise.
- Throws:
UiNotInitializedException
- if theDialog
containing this widget was not rendered yet.UiIllegalParameterException
- if click location is negative or extendsDialog
size limit: Dialog.DIALOG_MAX_WIDTH or Dialog.DIALOG_MAX_HEIGHTUiException
-
getColor
public int getColor() throws UiException
This method is not supported for this widget type and will throwUiNotSupportedException
.- Overrides:
getColor
in classWidget
- Returns:
- Returns the RGB color of the widget (bits 0-7 are blue, bits 8-15 are green, bits 16-23 are red, bits 24-31 are reserved).
- Throws:
UiNotSupportedException
- always.UiException
-
-