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


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

Re: Get frame reference

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!novia!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this>
Subject Re: Get frame reference
Message-ID <esaa04$m4d$1@registered.motzarella.org> (permalink)
X-Comment-To comp.lang.java.gui
Newsgroups comp.lang.java.gui
In-Reply-To <es9jl8$2nt$1@wblv-ip-nnrp-1.saix.net>
References <es9jl8$2nt$1@wblv-ip-nnrp-1.saix.net>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 29
Date Wed, 27 Apr 2011 15:31:18 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303918278 96.60.20.240 (Wed, 27 Apr 2011 10:31:18 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:31:18 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:1089

Show key headers only | View raw


  To: comp.lang.java.gui
Rogan Dawes wrote:
> Andrew Thompson wrote:
>> Component has a getParent() method.
>> Keep calling that in a loop till the
>> call returns a null component, and you
>> should have the root component.
>>
> And SwingUtilities has a method that will do this for you:

No. windowForComponent just calls getWindowAncestor. And 
getWindowAncestor returns the *first* Window ancestor of a given 
component. Andrew's method returns the *last* Component ancestor (which 
might be a Window).

To get the root Window (or root Applet) of a component, 
SwingUtilities#getRoot may be used. To get the root Component of a 
component use Andrew's method. To get a component's window use 
windowForComponent (or getWindowAncestor).

Of course, there might be additional predefined methods - who knows? ;)

Bye
Michael

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

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


Thread

Get frame reference "Tony B" <tony.b@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
  Re: Get frame reference "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
    Re: Get frame reference "Rogan Dawes" <rogan.dawes@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
      Re: Get frame reference "Tony B" <tony.b@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
      Re: Get frame reference "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000

csiph-web