Project frame focus & blur

Hi,  I'm trying to determine whether the current project frame has focus or not.  It's not too hard to do this by getting the JFrame (WindowManager.getInstance().getFrame(project)) and attaching a window focus listener however there is a limitation with this method.

Any time you bring up an idea dialog it you get a windowLostFocus event.  I'm only interested in knowing when the focus goes away from the project window and onto either another project window or to another application entirely.  Is there a workaround or a better alternative listener I can use?

Regards

Glen Stampoultzis

2 comments
Comment actions Permalink

In the focusListener.focusLost() method you can retrieve the opposite window
which will get the focus. If it is null, it is a different application.
Maybe this helps you.

Tom

0
Comment actions Permalink

On 07/10/2009 06:26, Glen Stampoultzis wrote:

Hi,  I'm trying to determine whether the current project frame has focus or not.  It's not too hard to do this by getting the JFrame (WindowManager.getInstance().getFrame(project)) and attaching a window focus listener however there is a limitation with this method.

>

Any time you bring up an idea dialog it you get a windowLostFocus event.  I'm only interested in knowing when the focus goes away from the project window and onto either another project window or to another application entirely.  Is there a workaround or a better alternative listener I can use?

>

Regards

>

Glen Stampoultzis

>

---
Original message URL: http://www.jetbrains.net/devnet/message/5246551#5246551

It's possible that the focus lost event you get for the dialog situation
has isTemporary() as true... haven't checked this however.
N.

0

Please sign in to leave a comment.