Login  Register

Re: How can I get input from an event handler?

Posted by Robert Dougherty on Aug 19, 2014; 3:14am
URL: http://imagej.273.s1.nabble.com/How-can-I-get-input-from-an-event-handler-tp5009243p5009259.html

Avital,

> If I would use the code in the link you sent me in one class:

> How would I access offscreenX and offscreenY from another class?

Why not have the "other class" implement the the MouseListener and MouseMotionListener interfaces and get the events itself?  You can tell the class about the ImagePlus to listen to in various ways, or it might discover it for itself with something like WindowManager.getCurrentImage().  Alternatively, the other, "processing" class could have methods that do something with the mouse coordinates, and the class with the MouseListener could invoke these, passing the coordinates. This would require the listening class to have a reference object in the processing class, somehow.

Bob

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html