Greetings,

In my attempts to handle GenericDialog(s) oversized windows, I was
perusing the code for GenericDialog and discovered two things I did not
know you should be able to do but didn't work...

1) using addToSameRow() just before showDialog(), which I assume is
intended to put Ok/Cancel buttons on the same row as the last defined
widget. The only problem, the Ok/Cancel buttons are put just past the edge
of the window on the same row.

The reason I was looking at this is when the GenericDialog is too big for
a screen the window is resized to fit the screen, albeit, the Ok/Cancel
buttons are off the screen. I suspect that the fix to the previous will
keep the Ok/Cancel button on the screen in this case.

2) I notice that the Shift-Ctrl-G sequence should cause a full screen
capture.  I tried this in a few of my existing GeneriDialog(s) and nothing
happened, although it seems to work in the provided example. This is not a
problem for me since this is not specific to the GenricDialog. What would
be nice is for pressing Ctrl-C within the GenericDialog would screen grab
just the displayed GenericDialog; where the OS window dressings are
desired. I would use this for preparing documentation for my plugins.

Thanks for listening,

Fred


/////// 1
import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;

public class TestaddToSameRow implements PlugIn {

   public void run(String arg) {
      GenericDialog gd = new GenericDialog("test addToSameRow Ok");
      gd.addMessage("This is a widget to have something in the
GenericDialog");
      gd.addMessage("Status Line");
      gd.addToSameRow();
      gd.showDialog();
      }

   }

// 2
//Works on both GenericDialog(s) and ImageWindow(s)
   public static ImagePlus snap(Window win) {
      try {
         Rectangle r = new Rectangle(win.getLocation(),win.getSize());
         new Robot().waitForIdle();
         ImagePlus imp = new ImagePlus("Snapshot",new
Robot().createScreenCapture(r));
         return imp;
         }
      catch(Exception e) {
         IJ.showStatus("Could not grab snapshot of window");
         }
      return null;
      }

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Reply via email to