Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #5274
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.java.gui |
| Subject | Re: How to find all my dialogs and frames |
| Date | 2012-12-01 09:03 -0500 |
| Organization | The Wasteland |
| Message-ID | <nospam-E7CE41.09033701122012@news.aioe.org> (permalink) |
| References | <4c82c435-e787-4c81-b14b-afa1291b8b6f@googlegroups.com> |
In article <4c82c435-e787-4c81-b14b-afa1291b8b6f@googlegroups.com>, FredK <fred.l.kleinschmidt@gmail.com> wrote: > How do I find all of the components my Swing app currently has? The > problem occurs when the app has created unparented dialogs. > > From any Component I can work up the tree by calling getParent() > until I reach null, then use the last non-null one as the trunk of > the component tree, which should be a Container. Recursively calling > getComponents() for all Conatiners fills in the tree. > > But if the app creates any unparented dialogs, the parent of those > dialogs is a SwingUtilities.SharedOwnerFrame which does not show up > in the list components of the root window. And even if it did, > calling getComponents() on the SharedOwnerFrame always returns empty. They might show up in the array returned by Window.getWindows(), which, with some caveats, "Returns an array of all Windows, both owned and ownerless, created by this application." -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar
How to find all my dialogs and frames FredK <fred.l.kleinschmidt@gmail.com> - 2012-11-30 13:48 -0800 Re: How to find all my dialogs and frames "John B. Matthews" <nospam@nospam.invalid> - 2012-12-01 09:03 -0500 Re: How to find all my dialogs and frames Roedy Green <see_website@mindprod.com.invalid> - 2012-12-13 00:53 -0800
csiph-web