"Il y a peu de choses qui me soient impossibles..."
My early investigations suggested to me that Swing is a non-starter here, as it has no support for touch events (I'd be glad to learn I am wrong about that).
What do you all think of this approach?
Touches on a touch screen also generate corresponding mouse events. For example, touching a point on the screen generates TOUCH_PRESSED and MOUSE_PRESSED events. Moving a single point on the screen generates scroll events and drag events. Even if your application does not handle touch or gesture events directly, it can run on a touch-enabled device with minimal changes by responding to the mouse events that are generated in response to touches.
If your application handles touches, gestures, and mouse events, make sure that you do not handle a single action multiple times. For example, if a gesture generates scroll events and drag events and you provide the same processing for handlers of both types of events, the movement on the screen could be twice the amount expected. You can use the isSynthesized() method for mouse events to determine if the event was generated by mouse movement or movement on a touch screen and only handle the event once.
/***************************************************************************
* Event handler methods. *
* *
* I'm not sure why only mouse events are here. What about drag and *
* drop events for instance? What about touch events? What about the *
* other mouse events? It does seem like these need to be here, because *
* for example mouse interaction logic might differ from platform to *
* platform, and the Behavior is supposed to implement all the user *
* interaction logic (not just key handling). So it seems like *
* BehaviorBase should have methods for handling all forms of input events,*
* and not just these four mouse events. *
**************************************************************************/
"Il y a peu de choses qui me soient impossibles..."
And then the flying monkeys attacked. My only defense was this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|