Issue
I am trying to use the Mouse and my TouchScreen pointers as independent devices. I use a 10 points Ilyama touchscreen connected to my laptop.
Everytime I move my finger on the touchscreen, the mouse pointer moves to the location where I pressed the touchscreen. I don't want that at all!. I want my mouse to stay where it is.
Is there a trick to detect if a MouseEvent is generated by a TouchEvent? I could remember the last "MouseDevice" and differentiate it from a "MouseTouch".
Then I could programmatically set the MouseDevice position back to where it was as soon as a MouseDevice event comes in.
Solution
There is a way to tell if a MouseEvent is coming from a TouchEvent.
`Mouse events Simulate mouse events enable an application to run on a device with a touch screen even if touch events are not handled by the application. Use the isSynthesized() method to determine if the mouse event is from a touch action. See Handling Mouse Events for an example.
If the MouseEvent isSynthesized() then it comes from a TouchEvent.
Read this to get a full understanding.
Answered By - SedJ601
Answer Checked By - Dawn Plyler (JavaFixing Volunteer)