Login  Register

Re: Which Image

Posted by Sullivan, Michael J (College of Med.) on Dec 22, 2005; 3:32pm
URL: http://imagej.273.s1.nabble.com/Which-Image-tp3704187p3704188.html

Hay Kurt.  Thanks for the example; it made me examine the methods for
the mouseEvent.  Instead of getComponent() I use getSource() which
returned a canvas with a unique name retrievable by
imageCanvas.getName().  So now it's on to the next part of the plugin.
Thanks, --- Mike

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
Kurt De Vos
Sent: Wednesday, December 21, 2005 12:07 PM
To: [hidden email]
Subject: Re: Which Image

This is a bit of sample code from a plugin of mine that might be
helpfull:

public CanvasSync(MyImageCanvas canvas1, MyImageCanvas canvas2) {
         this.canvas1 = canvas1;
         this.canvas2 = canvas2;
     }


     public void mouseClicked(MouseEvent mouseEvent) {}
     public void mouseReleased(MouseEvent mouseEvent) {}
     public void mousePressed(MouseEvent mouseEvent) {}
     public void mouseMoved(MouseEvent mouseEvent) {
         if (mouseEvent.getComponent().equals(canvas1)){
             //do something
         }else if (mouseEvent.getComponent().equals(canvas2)){
             //do something
         }
     }


kurt