void enableMouseMotionEvents() { if (!mouseMotionEvents) { canvas.addMouseMotionListener(this); mouseMotionEvents = true; } }
private void enableListeners( boolean enable ) { if (enable) { firstEvent = true ; if ( (listenerFlags & MOUSE_LISTENER)!=0) for(int i=0; i<canvases.length; i++) canvases[i].addMouseListener(this); if ( (listenerFlags & MOUSE_MOTION_LISTENER)!=0) for(int i=0; i<canvases.length; i++) canvases[i].addMouseMotionListener(this); if ( (listenerFlags & MOUSE_WHEEL_LISTENER)!=0) for(int i=0; i<canvases.length; i++) canvases[i].addMouseWheelListener(this); if ( (listenerFlags & KEY_LISTENER)!=0) for(int i=0; i<canvases.length; i++) canvases[i].addKeyListener(this); } else { if ( (listenerFlags & MOUSE_LISTENER)!=0) for(int i=0; i<canvases.length; i++) canvases[i].removeMouseListener(this); if ( (listenerFlags & MOUSE_MOTION_LISTENER)!=0) for(int i=0; i<canvases.length; i++) canvases[i].removeMouseMotionListener(this); if ( (listenerFlags & MOUSE_WHEEL_LISTENER)!=0) for(int i=0; i<canvases.length; i++) canvases[i].removeMouseWheelListener(this); if ( (listenerFlags & KEY_LISTENER)!=0) for(int i=0; i<canvases.length; i++) canvases[i].removeKeyListener(this); } }
@Override public void run(ImageProcessor ip) { if(imp.getStackSize() > 1 || !isPow2(imp.getWidth()) || !isPow2(imp.getHeight())) { IJ.error("Only one slice allowed, whose dimensions must" + " be a power of 2"); return; } bImage = createImage(); univ = new Image3DUniverse(); BranchGroup bg = new BranchGroup(); bg.addChild(createShape()); bg.compile(); univ.getScene().addChild(bg); univ.show(); univ.getCanvas().addMouseListener(this); univ.getCanvas().addMouseMotionListener(this); updater = new ImageUpdater(); ImagePlus.addImageListener(this); imp.show(); }
@Override public void run(ImageProcessor ip) { if(imp.getStackSize() > 1 || !isPow2(imp.getWidth()) || !isPow2(imp.getHeight())) { IJ.error("Only one slice allowed, whose dimensions must" + " be a power of 2"); return; } createImage(); univ = new Image3DUniverse(); BranchGroup bg = new BranchGroup(); bg.addChild(createShape()); bg.compile(); univ.getScene().addChild(bg); univ.show(); univ.getCanvas().addMouseListener(this); univ.getCanvas().addMouseMotionListener(this); updater = new ImageUpdater(); ImagePlus.addImageListener(this); imp.show(); }
getCanvas().addMouseMotionListener(new MouseMotionAdapter() {