Login  Register

Re: Pause in a java plugin program

Posted by Wayne Rasband on Feb 22, 2008; 3:46am
URL: http://imagej.273.s1.nabble.com/Pause-in-a-java-plugin-program-tp3697005p3697006.html

> If i wanted to put a pause in my java plugin program so that
> the user could select and cut part of the image and then press
> an "ok" type button to carry on with the program, is this
> possible and if so how?

You can use the WaitForUserDialog class that was added in ImageJ  
1.39r. For example

     new WaitForUserDialog("Do something, then click OK.").show();

or

     new WaitForUserDialog("Title", "Do something, then click  
OK.").show();

if you want to use a dialog title other than the default "Action  
Required".

In a macro, use

     waitForUser("Do something, then click OK");

or

     waitForUser("Title", "Do something, then click OK");

Add new lines characters ("\n") to display multiple lines in the  
dialog, for example

     waitForUser("Do something\nthen something else,\nthen click OK.");

-wayne