protected void registerTool(ImageCanvas canvas) { if (canvas == null) return; if (mouseProxy != null) canvas.addMouseListener(mouseProxy); addMouseMotionListener(canvas); addKeyListener(canvas); }
/** Adds "this" object as mouse listener and mouse motion listener to each of the windows in input array. */ private void addWindows(Vector v) { Integer I; ImagePlus imp; ImageWindow iw; // Handle initial case of no windows. if(vwins == null && v.size() > 0) vwins = new Vector(); // Add all windows in vector to synchronized window list. for(int n=0; n<v.size();++n) { I = (Integer)v.elementAt(n); // Make sure input window is not already on list. if(!vwins.contains(I)) { imp = WindowManager.getImage(I.intValue()); if (imp != null) { iw = imp.getWindow(); iw.getCanvas().addMouseMotionListener(this); iw.getCanvas().addMouseListener(this); vwins.addElement(I); } } } }
/** Adds "this" object as mouse listener and mouse motion listener to each of the windows in input array. */ private void addWindows(Vector v) { Integer I; ImagePlus imp; ImageWindow iw; // Handle initial case of no windows. if(vwins == null && v.size() > 0) vwins = new Vector(); // Add all windows in vector to synchronized window list. for(int n=0; n<v.size();++n) { I = (Integer)v.elementAt(n); // Make sure input window is not already on list. if(!vwins.contains(I)) { imp = WindowManager.getImage(I.intValue()); if (imp != null) { iw = imp.getWindow(); iw.getCanvas().addMouseMotionListener(this); iw.getCanvas().addMouseListener(this); vwins.addElement(I); } } } }
private void createListeners() { //IJ.log("createListeners"); if(srcImp == null) { return; } ImageCanvas canvas = srcImp.getCanvas(); if(canvas == null) { return; } canvas.addMouseListener(this); canvas.addMouseMotionListener(this); canvas.addKeyListener(this); ImagePlus.addImageListener(this); Font font = live.getFont(); live.setFont(new Font(font.getName(), Font.BOLD, font.getSize())); live.setForeground(Color.red); }
public ImageCanvas(ImagePlus imp) { this.imp = imp; paintPending = new AtomicBoolean(false); ij = IJ.getInstance(); int width = imp.getWidth(); int height = imp.getHeight(); imageWidth = width; imageHeight = height; srcRect = new Rectangle(0, 0, imageWidth, imageHeight); setSize(imageWidth, imageHeight); magnification = 1.0; addMouseListener(this); addMouseMotionListener(this); addKeyListener(ij); // ImageJ handles keyboard shortcuts setFocusTraversalKeysEnabled(false); //setScaleToFit(true); }
public ImageCanvas(ImagePlus imp) { this.imp = imp; paintPending = new AtomicBoolean(false); ij = IJ.getInstance(); int width = imp.getWidth(); int height = imp.getHeight(); imageWidth = width; imageHeight = height; srcRect = new Rectangle(0, 0, imageWidth, imageHeight); setSize(imageWidth, imageHeight); magnification = 1.0; addMouseListener(this); addMouseMotionListener(this); addKeyListener(ij); // ImageJ handles keyboard shortcuts setFocusTraversalKeysEnabled(false); //setScaleToFit(true); }
private void addListeners(ImageCanvas canvas) { canvas.addMouseListener(this); canvas.addMouseMotionListener(this); canvas.addKeyListener(this); win.addWindowListener (this); win.addMouseWheelListener(this); win.addFocusListener(this); ImagePlus.addImageListener(this); Executer.addCommandListener(this); }
private void addListeners(ImageCanvas canvas) { canvas.addMouseListener(this); canvas.addMouseMotionListener(this); canvas.addKeyListener(this); win.addWindowListener (this); win.addMouseWheelListener(this); win.addFocusListener(this); ImagePlus.addImageListener(this); Executer.addCommandListener(this); }
/** * Kill listeners. */ public void killListeners () { if(imp != null) { final ImageWindow iw = imp.getWindow(); if(null != iw) { final ImageCanvas ic = iw.getCanvas(); ic.removeKeyListener(pa); ic.removeMouseListener(pa); ic.removeMouseMotionListener(pa); ic.addMouseMotionListener(ic); ic.addMouseListener(ic); ic.addKeyListener(IJ.getInstance()); } } } /* end killListeners */
ill.start(); imp.getCanvas().addMouseListener( this ); imp.getCanvas().addMouseMotionListener( this ); imp.getCanvas().addKeyListener( this );
ill.start(); imp.getCanvas().addMouseListener( this ); imp.getCanvas().addMouseMotionListener( this ); imp.getCanvas().addKeyListener( this );
imp.getCanvas().addMouseListener( this ); imp.getCanvas().addMouseMotionListener( this ); imp.getCanvas().addKeyListener( this );
@Override public void run( final String arg ) { /* cleanup */ m.clear(); imp = IJ.getImage(); target = imp.getProcessor(); source = target.duplicate(); source.setInterpolationMethod( ImageProcessor.BILINEAR ); init(); createMapping(); painter = new MappingThread( imp, source, target, pleaseRepaint, mapping, interpolate ); painter.start(); Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Add_and_drag_handles." ) ); imp.getCanvas().addMouseListener( this ); imp.getCanvas().addMouseMotionListener( this ); imp.getCanvas().addKeyListener( this ); imp.getWindow().addKeyListener( this ); IJ.getInstance().addKeyListener( this ); }
imp.getCanvas().addMouseListener( this ); imp.getCanvas().addMouseMotionListener( this ); imp.getCanvas().addKeyListener( this );
@Override public void run( final String arg ) { /* cleanup */ m.clear(); imp = IJ.getImage(); target = imp.getProcessor(); source = target.duplicate(); source.setInterpolationMethod( ImageProcessor.BILINEAR ); init(); createMapping(); painter = new MappingThread( imp, source, target, pleaseRepaint, mapping, interpolate ); painter.start(); Toolbar.getInstance().setTool( Toolbar.getInstance().addTool( "Add_and_drag_handles." ) ); imp.getCanvas().addMouseListener( this ); imp.getCanvas().addMouseMotionListener( this ); imp.getCanvas().addKeyListener( this ); imp.getWindow().addKeyListener( this ); IJ.getInstance().addKeyListener( this ); }
ic.removeKeyListener(IJ.getInstance()); ic.addKeyListener(pa); ic.addMouseListener(pa); ic.addMouseMotionListener(pa); started = true;
imp.getCanvas().addMouseListener( roiListener );
ImageCanvas ic = yz_image.getCanvas(); ic.addKeyListener(this); ic.addMouseListener(this); ic.addMouseMotionListener(this); ic.setCustomRoi(true); ImageCanvas ic = xz_image.getCanvas(); ic.addKeyListener(this); ic.addMouseListener(this); ic.addMouseMotionListener(this); ic.setCustomRoi(true);
ImageCanvas ic = yz_image.getCanvas(); ic.addKeyListener(this); ic.addMouseListener(this); ic.addMouseMotionListener(this); ic.setCustomRoi(true); ImageCanvas ic = xz_image.getCanvas(); ic.addKeyListener(this); ic.addMouseListener(this); ic.addMouseMotionListener(this); ic.setCustomRoi(true);
canvas.addKeyListener(IJ.getInstance()); canvas.addMouseMotionListener(canvas); canvas.addMouseListener(canvas);