public class MyWidget implements UserWidget {
// check if point is inside the widget
public boolean contains (int x, int y) {
// find out, if the point lays within our bounds...
}
// Does the control have the focus? This should return true
// only if the widget has a TextField child that has the
// focus and false otherwise.
public boolean hasFocus() {
}
// control is losing the focus. Normally you do
// nothing in this method except there is a TextField
// child inside the control that has the focus.
public void loseFocus() {
}
// Handle a "pen down" event. Return an ActionEvent
// (or a "null" reference in case there is no event)
// The generated event is passed to the 'handleEvent()'
// method of the page the widget is added to.
public ActionEvent handlePenDown (int x, int y) {
}
// Handle a "pen move" event. Return an ActionEvent
// (or a "null" reference in case there is no event)
// The generated event is passed to the 'handleEvent()'
// method of the page the widget is added to.
public ActionEvent handlePenMove (int x, int y) {
}
// Handle a "pen up" event. Return an ActionEvent
// (or a "null" reference in case there is no event)
// The generated event is passed to the 'handleEvent()'
// method of the page the widget is added to.
public ActionEvent handlePenUp (int x, int y) {
}
// Handle a "key" event. Return an ActionEvent
// (or a "null" reference in case there is no event)
// The generated event is passed to the 'handleEvent()'
// method of the page the widget is added to.
public ActionEvent handleKeyDown (int keyCode) {
}
// Paint the user control.
public void paint () {
// use the canvas attribute to paint on screen.
}
}
|