Re: ImageListener: Adding imageFocused/Activated event would be nice
Posted by
Michael Schmid on
Jul 01, 2010; 7:08pm
URL: http://imagej.273.s1.nabble.com/ImageListener-Adding-imageFocused-Activated-event-would-be-nice-tp3687738p3687742.html
Hi Wolfgang,
maybe I don't understand the problem correctly, but what about this:
When the plugin is opened, get the list of open windows from the
WindowManager and register as a java.awt.event.WindowFocusListener
for each of them.
Then use the ImageJ WindowListener interface to get WindowOpened/
closed events; register as WindowFocusListener for images that will
be opened, and deregister on windows that will be closed.
Michael
________________________________________________________________
On 1 Jul 2010, at 17:44, Wolfgang Gross wrote:
> Thanks to Michael Ellis and Johannes Schindelin for their rapid
> replies.
>
> As a summary:
> As Johannes has pointed out, listening to all AWT events might have
> a rather
> heavy performance footprint. But then, most PCs today stay in in
> idle mode for
> more than 99%.
> Adding a special windowslistener on opening new images still leaves
> the task of
> handling all images already open when the plugin gets invoked.
>
> Adding a ImageFocused event to the ImageListener interface as
> supposed in the
> OP gives problems with backward compatibility, ok, but lets get
> "kicking and
> screaming into the century of the fruitbat" (copyright with Terry
> Pratchett).
>
> Thanks again
> Wolfgang