I have tried to capture the mouse pointer's x, y coordinations from java applications when the mouse pointer is loss the focus from the java application(ex. out of the boundry of a JFrame). There is a method in windows platform with the windows api and JNI but I want to do this in a platform independent manner.
03-13-2006, 01:35 AM
This is a place where the design decisions made with Java prevent you from doing what you say you want, outside of an API which exposes access to operating system functionality to you. What is going on outside of your program is outside of your program. There are only a limited avenues to communicate from the other programs to your Java program. JNI is one of them. Any of these avenues will be operating system dependent.
03-13-2006, 02:47 AM
That mean, Can't we do it even in the java 5.0?
03-13-2006, 08:58 AM
Even in Java 1.5. In order to read mouse coordinates you need to "listen" to the mouse pointer (interrupt then pass on). In order to do this outside of the Java Virtual Machine which is executing your program, you need to insert that listening process into the operating system. THAT is operating system specific.