views:

118

answers:

1

Is there any cross-platform way to figure out which window is at a certain point on the screen?

If there is not, what would be the equivalent function to getWindowAtPoint for linux (X11?) and OS X?

A: 

There is functionality in Swing to identify the component at a given point. There is no support in the Java Runtime for inquering about other windows, but the robot-classes can grab screenshots.

What do you need to do?

Thorbjørn Ravn Andersen
I am actually trying to implement the functionality of a macroing program (http://www.kaitnieks.com/scar which uses getWindowAtPoint). It is not very important, but I was wondering if there would be a way to do it in java.
Jeremybub
If it is a non-java Window you want to work with, you cannot do that with the capabilities of Java 6. You will need to use a library that talks to the operating system with JNI or JNA. I do not know of such a library :(
Thorbjørn Ravn Andersen