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


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

Re: Giving JDialog the co

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)
Newsgroups comp.lang.java.gui
References <1175444052.070924.271230@q75g2000hsh.googlegroups.com>
Date 2011-04-27 15:32 +0000
Organization TDS.net

Show all headers | 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