warrenm
warrenm

Reputation: 31792

How can I detect when new windows are opened and/or get a list of open windows?

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.

Upvotes: 5

Views: 1162

Answers (3)

Giann
Giann

Reputation: 3192

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

Upvotes: 3

Lars
Lars

Reputation: 1121

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.

Upvotes: 0

camickr
camickr

Reputation: 324207

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

But these are only Windows opened by your Java app.

Upvotes: 1

Related Questions