Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #5281

Re: How to find all my dialogs and frames

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.gui
Subject Re: How to find all my dialogs and frames
Date 2012-12-13 00:53 -0800
Organization Canadian Mind Products
Message-ID <or5jc8te04ekiva1gghft3ug1clm0ua9nk@4ax.com> (permalink)
References <4c82c435-e787-4c81-b14b-afa1291b8b6f@googlegroups.com>

Show all headers | View raw


On Fri, 30 Nov 2012 13:48:16 -0800 (PST), FredK
<fred.l.kleinschmidt@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>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.

If Java won't track them for you, add them as you create them to a
collection.
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Students who hire or con others to do their homework are as foolish 
as couch potatoes who hire others to go to the gym for them. 

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Find similar


Thread

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