Hello
I did some google searching on this, but could not find anything useful.
When creating a program (with GUI) with Java code for a touch screen. Would I have to code differently ?
I would greatly appreciate some help.
Thank You.
Printable View
Hello
I did some google searching on this, but could not find anything useful.
When creating a program (with GUI) with Java code for a touch screen. Would I have to code differently ?
I would greatly appreciate some help.
Thank You.
If you are using the standard Java libraries (Swing etc) then these are platform independent, so a touch screen can be treated just like any other pointing device.
If you are going to rely on gestures (eg expand/shrink/scroll based on two points) then you either do some time based analysis or use some (non Java) way of getting that information from the hardware. I haven't actually written anything for devices that "pinch" etc so I wouldn't know how common or accessible they and their drivers are.
Keep in mind that on a touch screen display, the "Mouse" object never moves steadily. When it's tapped, it moves to the position of the touch (on most systems, anyway), so the event X and Y will be accurate. (Also when holding down, I believe a dragging event is invoked.) Obviously, though, there is no way to track motion without the user touching the display.
In general, no, you will not have to code differently.
Cool
Thank You Guys.
Not really; most ordinary touch screens can only sense a finger/pen on screen or off screen; there is no notion of a button click. The screen can detect motion of the finger/pen but that's it. More expensive screens can detect multiple fingers/pens but they're not mainstream devices (yet).
The more 'sophisticated' drivers mimick mouse clicks by organizing quick taps (on screen, off screen sequences) within a small time interval.
kind regards,
Jos