Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to detect when the application loses or takes focus



Ian Cheyne wrote:

>Is the best way to just watch for WindowEvents and (using
>getOppositeWindow()) establish that if the oppositeWindow is null that the
>application is either losing or taking focus. I'm using and targetting
>Java 1.4.2.

I vaguely recall a bug with getOppositeWindow(), but I can't recall if it
was null when it shouldn't have been, or was non-null when it should have
been.  Try searching the archives.


>Or is there a better/easier way?

The javadocs for getOppositeWindow() describe the switch between
applications as returning an opposite window of null, confirming your
proposed strategy (modulo any bugs, and qualified by event-type).

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.