Possible Duplicate:
how to obtain mouse click coordinates outside my window in Java
Is it possible to detect a mouseClick with java no matter in what application you are?
For example, now i'm in my browser and soon i hit 'Post Your Question'
I would like to register that mouse click.
And if possible the detection between right and left mouse button would be even better.
possible?
edit:
It is not for a browser!!
I want to track my mouse behaviour while i'm playing a third person shooter.
-
1What application feature do you wish to offer the end user?Andrew Thompson– Andrew Thompson2012年09月07日 15:35:00 +00:00Commented Sep 7, 2012 at 15:35
-
Attempting to mess with the users input controls outside of your applets UI is a perfect way to ensure the user will at maximum visit a site once.Durandal– Durandal2012年09月07日 15:37:56 +00:00Commented Sep 7, 2012 at 15:37
-
And isn't this sort of thing controlled at the OS level anyways? Because it routes the events to the 'focus' window? So wouldn't you have to register some sort of native handler? So we may need the target OS... You may have better luck making/using a Java-based browser that you can write plugins for, or something.Clockwork-Muse– Clockwork-Muse2012年09月07日 15:39:22 +00:00Commented Sep 7, 2012 at 15:39
-
It's not to ensure the user will visit once :) I want to track my mouse behaviour while playing a game.clankill3r– clankill3r2012年09月07日 15:42:26 +00:00Commented Sep 7, 2012 at 15:42
1 Answer 1
I don't know if there's a library for Java that allows you to record keyboard/mouse inputs and then replay them however, you can use java.awt.Robot to script any mouse/keyboard behavior:
http://docs.oracle.com/javase/6/docs/api/java/awt/Robot.html
Here's an example that types "Hi buddy" for you:
http://www.javalobby.org/java/forums/t84094.html
The only software that I've used that allows you to record keyboard/mouse inputs and then play them back to you is IBM Functional Tester.
Comments
Explore related questions
See similar questions with these tags.