public PlugInDialog(String title) {
   super(IJ.isMacOSX() ? IJ.getInstance() : IJ.isJava16() ? null : new Frame(), title);
   enableEvents(AWTEvent.WINDOW_EVENT_MASK);
   this.title = title;
   ImageJ ij = IJ.getInstance();
   if (IJ.isMacOSX() && ij != null) {
     ij.toFront(); // needed for keyboard shortcuts to work
     IJ.wait(250);
   }
   addWindowListener(this);
   addFocusListener(this);
   if (IJ.isLinux()) setBackground(ImageJ.backgroundColor);
   if (ij != null && !IJ.isMacOSX() && IJ.isJava16()) {
     Image img = ij.getIconImage();
     if (img != null)
       try {
         setIconImage(img);
       } catch (Exception e) {
       }
   }
 }
 public void windowActivated(WindowEvent e) {
   ImageJ ij = IJ.getInstance();
   if (IJ.isMacOSX() && ij != null && !ij.isActive() && !(this instanceof ThresholdAdjuster))
     ij.toFront();
   WindowManager.setWindow(this);
 }