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


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

Re: Giving JDialog the co

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!news-out.readnews.com!transit3.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Lionel van den Berg" <lionel.van.den.berg@THRWHITE.remove-dii-this>
Subject Re: Giving JDialog the co
Message-ID <4610244e$1@dnews.tpgi.com.au> (permalink)
X-Comment-To comp.lang.java.gui
Newsgroups comp.lang.java.gui
In-Reply-To <1175444052.070924.271230@q75g2000hsh.googlegroups.com>
References <1175444052.070924.271230@q75g2000hsh.googlegroups.com>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 41
Date Wed, 27 Apr 2011 15:32:54 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303918374 96.60.20.240 (Wed, 27 Apr 2011 10:32:54 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:32:54 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:1366

Show key headers only | View raw


  To: comp.lang.java.gui
Dan Andrews wrote:
> On Apr 1, 3:09 am, Lionel van den Berg <lione...@gmail.com> wrote:
> [snip]
>> Does anyone have a design solution to this? I sort of thought that I
>> might have a class that tracks the active window, but then all windows
>> would have to register and de-register with this class . . . doesn't
>> seem very convenient.
>>
>> Any help appreciated.
>>
>> Lionel.
> 
> Hi Lionel,
> 
> In addition to Andrew's solution, Frame has a method named getFrames
> which will return a list of all Frames and if you only have one JFrame
> you could use:
> 
> JFrame myFrame = (JFrame)Frame.getFrames()[0];
> 
> In JDK 1.6 you can use Window.getWindows() too.

Not using 1.6 yet :(. Decided to support 1.5 as it's still not too old.


> Otherwise, you will need to determine which of the Frames isActive()
> or use some other method to determine if the frame is the frame you
> want.

Excellent. I do Frame.getFrames(); and then iterate through them calling 
isActive() to get the active frame. It now works perfectly.

Thanks to both responses. :).

Lionel.

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

Giving JDialog the correc "Lionel van den Berg" <lionel.van.den.berg@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
  Re: Giving JDialog the co "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
  Re: Giving JDialog the co "Dan Andrews" <dan.andrews@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000
    Re: Giving JDialog the co "Lionel van den Berg" <lionel.van.den.berg@THRWHITE.remove-dii-this> - 2011-04-27 15:32 +0000

csiph-web