protected void handleImage(ImagePlus image, boolean addAsListener) { ImageWindow window = image.getWindow(); for (Component comp : window.getComponents()) if (comp instanceof Scrollbar) { Scrollbar bar = (Scrollbar)comp; if (addAsListener) bar.addAdjustmentListener(this); else bar.removeAdjustmentListener(this); } if (addAsListener) window.addWindowListener(this); else window.removeWindowListener(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); }
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); }
/** * Method to start the dynamic reslice process after all parameters * have been set. Will not initiate as long as there is no ROI. */ public void start() { if (hasStarted || imp.getRoi() == null) return; // Get type of source window rgb = imp.getType() == ImagePlus.COLOR_RGB; notFloat = !rgb && imp.getType() != ImagePlus.GRAY32; // Create the destination ImagePlus dest_imp by get a slice a first time. dest_imp = new ImagePlus("Dynamic Reslice of "+imp.getShortTitle(), getSlice(imp, imp.getRoi())); dealWithCalibration(); // Copy min & max to new result final ImageProcessor ip = imp.getProcessor(); final double min = ip.getMin(); final double max = ip.getMax(); if (!rgb) dest_imp.getProcessor().setMinAndMax(min, max); // Display window result dest_imp.show(); // Add listeners imp.getCanvas().addMouseMotionListener(this); imp.getWindow().addWindowListener(this); dest_imp.getWindow().addWindowListener(this); // Set the started flag to true hasStarted = true; }
KymographMouseListener listener = new KymographMouseListener(canvas, image, rois); canvas.addMouseMotionListener(listener); result.getWindow().addWindowListener(listener); return result;
KymographMouseListener listener = new KymographMouseListener(canvas, this.image, rois); canvas.addMouseMotionListener(listener); image.getWindow().addWindowListener(listener);
window.addWindowListener(this); handler = new MTJHandler(this); window.addKeyListener(handler);
add(ic); addFocusListener(this); addWindowListener(this); addWindowStateListener(this); addKeyListener(ij);
add(ic); addFocusListener(this); addWindowListener(this); addWindowStateListener(this); addKeyListener(ij);