public void unregister() { ImagePlus.removeImageListener(this); if (window == null) return; window.removeWindowListener(this); window.removeMouseWheelListener(this); for (Component child : window.getComponents()) if (child instanceof Scrollbar) ((Scrollbar)child).removeAdjustmentListener(this); else if (child instanceof Container) for (Component child2 : ((Container)child).getComponents()) if (child2 instanceof Scrollbar) ((Scrollbar)child2).removeAdjustmentListener(this); }
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); }
this.speedbar.removeAdjustmentListener(this); this.runbutton.removeActionListener(this); this.pausebutton.removeActionListener(this); this.sizebar.removeAdjustmentListener(this); this.quitbutton.removeActionListener(this); Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
this.speedbar.removeAdjustmentListener(this); this.runbutton.removeActionListener(this); this.pausebutton.removeActionListener(this); this.sizebar.removeAdjustmentListener(this); this.quitbutton.removeActionListener(this); Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
/** * Remove both ours and the backed up event handlers. */ final void clearGui() { for ( final KeyListener l : canvasKeyListeners ) canvas.removeKeyListener( l ); for ( final KeyListener l : windowKeyListeners ) window.removeKeyListener( l ); for ( final KeyListener l : ijKeyListeners ) ij.removeKeyListener( l ); for ( final MouseListener l : canvasMouseListeners ) canvas.removeMouseListener( l ); for ( final MouseMotionListener l : canvasMouseMotionListeners ) canvas.removeMouseMotionListener( l ); for ( final MouseWheelListener l : windowMouseWheelListeners ) window.removeMouseWheelListener( l ); for ( final AdjustmentListener l : scrollBarAdjustmentListeners ) scrollBar.removeAdjustmentListener( l ); canvas.removeKeyListener( Stack_Rotate.this ); window.removeKeyListener( Stack_Rotate.this ); ij.removeKeyListener( Stack_Rotate.this ); canvas.removeMouseListener( Stack_Rotate.this ); canvas.removeMouseMotionListener( Stack_Rotate.this ); window.removeMouseWheelListener( Stack_Rotate.this ); scrollBar.removeAdjustmentListener( Stack_Rotate.this ); } }
/** * Remove both ours and the backed up event handlers. */ final void clearGui() { for ( final KeyListener l : canvasKeyListeners ) canvas.removeKeyListener( l ); for ( final KeyListener l : windowKeyListeners ) window.removeKeyListener( l ); for ( final KeyListener l : ijKeyListeners ) ij.removeKeyListener( l ); for ( final MouseListener l : canvasMouseListeners ) canvas.removeMouseListener( l ); for ( final MouseMotionListener l : canvasMouseMotionListeners ) canvas.removeMouseMotionListener( l ); for ( final MouseWheelListener l : windowMouseWheelListeners ) window.removeMouseWheelListener( l ); for ( final AdjustmentListener l : scrollBarAdjustmentListeners ) scrollBar.removeAdjustmentListener( l ); canvas.removeKeyListener( Stack_Rotate.this ); window.removeKeyListener( Stack_Rotate.this ); ij.removeKeyListener( Stack_Rotate.this ); canvas.removeMouseListener( Stack_Rotate.this ); canvas.removeMouseMotionListener( Stack_Rotate.this ); window.removeMouseWheelListener( Stack_Rotate.this ); scrollBar.removeAdjustmentListener( Stack_Rotate.this ); } }