Re: setYesLabel and setNoLabel
Posted by
Eirinn Mackay on
Jul 02, 2009; 11:22pm
URL: http://imagej.273.s1.nabble.com/setYesLabel-and-setNoLabel-tp3691928p3691930.html
Perfect, thanks Wayne :)
Michael: I knew about setOKlabel, but that only works if you have two
buttons, OK and Cancel. With the new function that Wayne wrote, we can
now have an extra button without the complexity of adding a panel. For
example, one could have "OK", "Cancel", and "Browse...".
Cheers,
Eirinn
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Eirinn Mackay
Research Assistant
Bartlett Group L6
Queensland Brain Institute
Brisbane, Australia
07 334 66381
On 03/07/2009, at 12:04 AM, Wayne Rasband wrote:
>> 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