Received: by 10.66.84.7 with SMTP id u7mr453333pay.26.1354312096677; Fri, 30 Nov 2012 13:48:16 -0800 (PST) Received: by 10.50.196.199 with SMTP id io7mr2669900igc.4.1354312096588; Fri, 30 Nov 2012 13:48:16 -0800 (PST) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!kr7no9036745pbb.0!news-out.google.com!6ni18488pbd.1!nntp.google.com!kr7no9036740pbb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.java.gui Date: Fri, 30 Nov 2012 13:48:16 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=130.76.32.213; posting-account=_7xgmwoAAADi7iXKBO-oX5zbCfSzsCV0 NNTP-Posting-Host: 130.76.32.213 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4c82c435-e787-4c81-b14b-afa1291b8b6f@googlegroups.com> Subject: How to find all my dialogs and frames From: FredK Injection-Date: Fri, 30 Nov 2012 21:48:16 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com comp.lang.java.gui:5272 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.