Login  Register

Re: GenericDialog programmatic "OK" ?

Posted by Michael Schmid on Jul 17, 2009; 12:31pm
URL: http://imagej.273.s1.nabble.com/GenericDialog-programmatic-OK-tp3691723p3691729.html

Hi Joachim,

you could call gd.actionPerformed with a new ActionEvent that has the  
OK button as a source. The problem: there is no GenericDialog method  
that returns a reference to this button.

It would be great to have GenericDialog function that returns the  
list of Buttons (this would be helpful also for other purposes, e.g.,  
enabling/disabling/changing a Button label).
Otherwise, you have to step through the components of gd.getComponents
() to find the panel with the buttons and then step through its  
getComponents() to find the OK button.

Michael
________________________________________________________________

On 17 Jul 2009, at 14:13, Joachim Wesner wrote:

> Hi,
>
> just another question....
>
> I have a plugin that somehow streches the possibilities of  
> GenericDialog
> but I am too lazy to rewrite the GUI using "standard java" in a plugin
> frame.
>
> I have a DialogListener thar directly responds to some checkboxes  
> to, for
> example, read a data file and fill in some of the dialog fields  
> based on
> that.
>
> I would like to add the option that after reading these data, the  
> dialog is
> automatically closed and processing starts immediately, i.e. I  
> somehow need
> to
> simulate clicking "OK" by the user from within the DialogListener .  
> What
> would be the easiest way to acchieve this?
>
> Mit freundlichen Grüßen / Best regards
>
> Joachim Wesner