import ij.IJ; import ij.gui.GenericDialog; import ij.plugin.PlugIn; /** This plugin demonstrates how to display a dialog at a specified location on the screen. It required ImageJ 1.42h or later. */ public class Place_Dialog implements PlugIn { public void run(String arg) { // construct generic dialog GenericDialog gd = new GenericDialog("Who Are You?"); gd.addStringField("Name: ", "", 30); if (IJ.getVersion().compareTo("1.42h")>=0) gd.centerDialog(false); gd.setLocation(100, 100); gd.showDialog(); if (gd.wasCanceled()) return; // do something trivial with the input String name = gd.getNextString(); if (name == null) name = ""; name = name.trim(); if (name.equals("")) IJ.showMessage("Hello!"); else IJ.showMessage("Hello, " + name + "!"); } }