Thomas Paltz
Thomas Paltz

Reputation: 55

Getting coordinates of open windows in java on a mac

I need to be able to find the coordinates of windows open in a computer even if they are not created by my application or by another java application. I am at a loss for any way of doing this besides screen-shotting the whole screen and then trying to have the app trace the outlines of each window, which seems horribly innefficient and probably not very effective (what if the windows were overlapping)?

Any help is hugely appreciated: I've spent all day trying to figure it out!

Note: I need to do this on a mac, and I don't need to be able to port it to windows.

Upvotes: 2

Views: 387

Answers (1)

Hovercraft Full Of Eels
Hovercraft Full Of Eels

Reputation: 285460

You need to get information from the operating system, and there are various ways to do that with Java, but none use only core Java. I suggest trying out JNA to allow you to call OS functions directly without all the fuss involved with using JNI.

Upvotes: 2

Related Questions