Exemple #1
0
 /**
  * Creates a new GenericDialog with the specified title. Uses the current image image window as
  * the parent frame or the ImageJ frame if no image windows are open. Dialog parameters are
  * recorded by ImageJ's command recorder but this requires that the first word of each label be
  * unique.
  */
 public GenericDialog(String title) {
   this(
       title,
       WindowManager.getCurrentImage() != null
           ? (Frame) WindowManager.getCurrentImage().getWindow()
           : IJ.getInstance() != null ? IJ.getInstance() : new Frame());
 }
Exemple #2
0
 private static Frame getParentFrame() {
   Frame parent =
       WindowManager.getCurrentImage() != null
           ? (Frame) WindowManager.getCurrentImage().getWindow()
           : IJ.getInstance() != null ? IJ.getInstance() : new Frame();
   if (IJ.isMacOSX() && IJ.isJava18()) {
     ImageJ ij = IJ.getInstance();
     if (ij != null && ij.isActive()) parent = ij;
     else parent = null;
   }
   return parent;
 }
 public ImageCanvas(ImagePlus imp) {
   this.imp = imp;
   ij = IJ.getInstance();
   int width = imp.getWidth();
   int height = imp.getHeight();
   imageWidth = width;
   imageHeight = height;
   srcRect = new Rectangle(0, 0, imageWidth, imageHeight);
   setDrawingSize(imageWidth, (int) (imageHeight));
   magnification = 1.0;
   addMouseListener(this);
   addMouseMotionListener(this);
   addKeyListener(ij); // ImageJ handles keyboard shortcuts
   setFocusTraversalKeysEnabled(false);
 }