views:

115

answers:

3

I am aware of WindowListener and its ilk, but these only seem to provide events for windows to which you have a reference already and can add the listener to. I'm wondering how to either receive a callback when new windows are created by other processes, or poll for a list of all windows currently open on the system.

I'm using J2SE on Mac OS X, but a cross-platform answer is ideal.

A: 
Window.getWindows();
Window.getOwnedWindows();
Window.getOwnerlessWindows();

But these are only Windows opened by your Java app.

camickr
A: 

I think that's not possible due to the sandbox idea behind the JRE. You can only "see" Windows from your own process. But I don't know for sure.

Lars
+2  A: 

Like already said above you can only monitor windows created by Java apps. Getting that kind of information would require OS specific development (JNI).

Giann