Re: setYesLabel and setNoLabel
Posted by Wayne Rasband on Jul 02, 2009; 2:04pm
URL: http://imagej.273.s1.nabble.com/setYesLabel-and-setNoLabel-tp3691928p3691929.html
> Hi,
> I'm building a GUI for my plugin and I've just realised I could
> achieve quite a bit with the GenericDialog if I could set the captions
> of the Yes and No buttons. In my case, I want the no button to say
> "Add another file" and the yes button to say "Run batch". I think this
> is a very simple way of making the generic dialog more versatile.
> So would it be possible to add two more functions to the GenericDialog
> class?
The GenericDialog class in the v1.43c daily build adds a
enableYesNoCancel(yesLabel, noLabel) method. Here is an example that
shows how to use it:
GenericDialog gd = new GenericDialog("YesNoCancel Demo");
gd.addMessage("This is a custom YesNoCancel dialog");
gd.enableYesNoCancel("Run batch", "Add another file");
gd.showDialog();
if (gd.wasCanceled())
IJ.log("The user clicked on the 'Cancel' button");
else if (gd.wasOKed())
IJ. log("The user clicked on the 'Yes' button");
else
IJ. log("The user clicked on the 'No' button");
-wayne