Java Reference
In-Depth Information
} protected void pointerPressed(int x, int y)
{
pressed.x = x;
pressed.y = y;
// TODO: handle event accordingly
} protected void pointerReleased(int x, int y)
{
released.x = x;
released.y = y;
// TODO: handle event accordingly
} protected void pointerDragged(int x, int y)
{
dragged.x = x;
dragged.y = y;
// TODO: handle event accordingly
}
}
// Encapsulation of [x,y] point on the screen
class TouchPoint
{
int x, y;
public String toString() {
return "[" + x + "," + y + "]";
}
}
To ensure that a user can use your application with a touch screen, you
first need to add code to handle stylus events to the relevant Canvas-based
screens.
4.6.2 Replacing Directional Keys
There are other issues that we need to consider when targeting a variety of
Symbian smartphones and how your application must support the input
mechanism used on that phone. These issues are not all enumerated,
but we refer to a few to highlight how to plan to handle various input
mechanisms.
A phone designed for touch-screen interaction might not have direc-
tional keys. You might design the greatest space invaders game but would
a user enjoy playing it using the stylus? You need to think about such
cases.
It is possible that your application is simply not suitable for this class
of devices.
If there are no directional keys, perhaps there is another set of
designated keys on the device? For example, the Sony Ericsson W960i
has a jog dial as the standard mechanism for scrolling up and down
and selecting items.
 
Search WWH ::




Custom Search