I’ve been using the java.awt.Robot
class to control the cursor for actions that are analogous to having a mouse (as in: mouse move, mouse button press, mouse button release). However, on many laptops the trackpad allows more complex gestures that are not possible with a mouse. For example, on a Macbook I can multifinger pinch to show apps, and multifinger swipe to switch desktops. I want to be able to simulate these events in my java app but haven’t found any mention online as to whether it’s possible. Has anyone managed to do this?
Asked
Active
Viewed 254 times
2

owengall
- 455
- 4
- 11
-
you want to simulate a laptop touchpad with a mouse or what ? – Z3RP Jan 27 '20 at 14:28
-
There’s no external mouse involved. I give my java app permission to take control of the cursor and keyboard on my laptop, but the cursor manipulation methods for AWT's Robot don’t appear to include trackpad-specific gestures. – owengall Jan 28 '20 at 04:45
-
Did you ever find an answer to this? – user1111929 Aug 29 '21 at 17:46
-
@user1111929 Nope, I think I never did. We’ll just have to wait a little bit longer... – owengall Aug 30 '21 at 02:00
-
I haven't thought about simulating / firing mac gestures before, will look at that, just figured out how to actually use them in a Java app, see https://stackoverflow.com/questions/48535595/what-replaces-gestureutilities-in-java-9, if you take the work further and discover how to generate them please update here – Hamish258 Feb 05 '22 at 20:23