How can I intercept and modify mouse events (x/y coordinates, acceleration, etc.) via Java, before they reach a third party application?
The application is known beforehand (so something like "java myApp 3rdPartyApp" is possible, if it helps). Do note that the third-party application may be very resource-intensive.
I guess what I'm asking is how can I make a Java app that serves as a layer between the real mouse events and the third-party application so that the third-party app receives the modified events b开发者_JAVA百科ut not the original ones sent by the OS? Is this even possible with Java?
You have 2 pure java solutions.
First, you can connect to the AWT event queue and get all UI events: Toolkit.getDefaultToolkit().getSystemEventQueue()
Unfortunately I am not sure you can modify these events but you can read them and you can simulate events.
Second you can create transparent window over your third party application where you can catch all UI events and then simulate them using java.awt.Robot
.
Please see here how to create transparent window. I tried this method and see that it works well.
精彩评论