|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
The UserWidget interface is implemented by user interface elements that are to be used in the DynaWorks framework. They can be build from scratch or you can group existing user interface elements to create a more "complex" control.
A UserWidget can occupy any rectangular area on the screen; the coordinates are usually passed to the object as arguments to the constructor. The UserWidget is responsible for rendering itself and to handle all events related to user interaction.
Rendering is done through implementing the "paint()" method, while the event methods are used to react to user interaction. Each "handleXXX()" method passes back an ActionEvent object.
This ActionEvent object is the event generated by the widget based on the user interaction. So a click on a Button would generate an event "ActionEvent (button, ActionEvent.INVOKED)", a click on a Checkbox would generate "ActionEvent (cb, ActionEvent.VALUE_CHANGED)". If the widget does not want to emit an event (because there is no action or state change to be reported), it can pass back a "null" reference. For a closer description on the ActionEvent codes see the corresponding class.
ActionEvent,
Page| Method Summary | |
boolean |
contains(int x,
int y)
Check if the given point hits the user control. |
ActionEvent |
handleKeyDown(int keyCode)
Handle a "character key" event. |
ActionEvent |
handlePenDown(int x,
int y)
Handle a "pen down" event. |
ActionEvent |
handlePenMove(int x,
int y)
Handle a "pen move" event. |
ActionEvent |
handlePenUp(int x,
int y)
Handle a "pen up" event. |
ActionEvent |
handleSysKeyDown(int keyCode)
Handle a "system key" event. |
boolean |
hasFocus()
Does the control have the focus? |
void |
loseFocus()
control is losing the focus. |
void |
paint()
Paint the user control. |
void |
setFocus()
Set focus on the control. |
| Method Detail |
public boolean contains(int x,
int y)
N.B.: Do NOT change the inner state of the control.
x - int - x coordinate of pointy - int - y coordinate of pointpublic void setFocus()
public boolean hasFocus()
public void loseFocus()
public ActionEvent handlePenDown(int x,
int y)
x - int - x coordinate of pointy - int - y coordinate of pointActionEvent
public ActionEvent handlePenMove(int x,
int y)
x - int - x coordinate of current pointy - int - y coordinate of current pointActionEvent
public ActionEvent handlePenUp(int x,
int y)
x - int - x coordinate of current pointy - int - y coordinate of current pointActionEventpublic ActionEvent handleKeyDown(int keyCode)
keyCode - int - ASCII character representationActionEventpublic ActionEvent handleSysKeyDown(int keyCode)
keyCode - int - id of pressed keyActionEventpublic void paint()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||