Login  Register

Re: ImageListener: Adding imageFocused/Activated event would be nice

Posted by dscho on Jul 01, 2010; 9:11am
URL: http://imagej.273.s1.nabble.com/ImageListener-Adding-imageFocused-Activated-event-would-be-nice-tp3687738p3687743.html

Hi,

On Thu, 1 Jul 2010, Wolfgang Gross wrote:

> plugins that implement the ImageListener interface are notified when an
> image is Opened/Closed/Updated. In addition, it would be nice to get
> notified immediately when an image gets the focus so plugins can keep
> track of the current image. Calling WindowManager.getCurrentImage() when
> the plugin itself gains focus is not what I need.

Why don't you just register a WindowListener upon imageOpened() which you
unregister upon imageClosed()?

That would be backwards compatible, even if a newer ImageJ version
acquires imageFocused()/imageActivated() methods in the ImageListener
interface: older ImageJ versions would just throw an exception because
_their_ ImageListener interface knows nothing about the new methods.

Ciao,
Johannes