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


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

Re: Giving JDialog the co

From "Dan Andrews" <dan.andrews@THRWHITE.remove-dii-this>
Subject Re: Giving JDialog the co
Message-ID <1175444052.070924.271230@q75g2000hsh.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <460f7681$1@dnews.tpgi.com.au>
Date 2011-04-27 15:32 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
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.

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.

Cheers,
Dan Andrews
-------------------
http://www.ansir.ca

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