Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enumerating open windows



Elliotte Harold wrote:

Anyone know a straightforward or sneaky way to get list of all the
currently open windows? I'm looking for something generic that could be
used for testing purposes without necessarily having to maintain a list
of every window and dialog I've opened inside my application. For my
purposes this does need to be cross-platform.

Frame.getFrames returns a list of all Frames allocated by the current application (as was previously mentioned). Note that it only returns Frame (and thus includes JFrame) instances, not Dialog/JDialog, or plain Window instances. If you iterate the list of frames and call getOwnedWindows (which Frame inherits from Window) you can get all the subwindows owned by that window. Since all instantiated Dialog, JDialog and directly instantiated Window instances must have a non- null owner, this should get you a complete enumeration.

This requires Java 1.2+, and so only excludes older JVMs.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.