0

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.

Community
  • 1
  • 1
clankill3r
  • 9,146
  • 20
  • 70
  • 126
  • 1
    What application feature do you wish to offer the end user? – Andrew Thompson Sep 07 '12 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 Sep 07 '12 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 Sep 07 '12 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 Sep 07 '12 at 15:42

1 Answers1

0

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.

p_strand
  • 597
  • 6
  • 8