I don't think you can do that in Java. You can do it in C++ easy enough by installing an OS hook. Used generally by macro programs and spyware.
But I don't think Java has this kind of access to WIN32. Maybe through JNI?
Jeff Heaton
http://www.heatonresearch.com
JeffHeaton
Junior Poster in Training
58 posts since Jul 2005
Reputation Points: 12
Solved Threads: 0
You can get the mouse coordinates of the mouse.
That will give you the location on screen.
From that you could get the Component the mouse is over.
From that you can retrieve a Graphics object which can draw that component.
From that you can retrieve an offset Graphics object which can draw that component somewhere else (if I read the API docs correctly).
What I don't know is whether any of that will do you much good :)
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
you could try to write one yourself.
a bit like:
[Code=Java]
if ( mousePressed() ){
while(mousePressed() ){}
System.out.println("mouse is pressed");
}
[Code]
logic
also, for a next time, there's no need to revive threads that have been inactive for over 4 years, you are allowed to create your own.
stultuske
Posting Sensei
3,110 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 432