Login  Register

Re: "WaitForUserDialog" doesn't work in my "ActionListener" plugin

Posted by Ghislain BUGNICOURT-2 on Oct 28, 2009; 2:09pm
URL: http://imagej.273.s1.nabble.com/WaitForUserDialog-doesn-t-work-in-my-ActionListener-plugin-tp3690634p3690636.html

Hi,
Now it works well, thank you !

Details : this method...
> public void actionPerformed(ActionEvent e) {
> new WaitForUserDialog("CCCC", "DDDD").show();
> }

...was changed into :
> public void actionPerformed(ActionEvent e) {
> Thread waitDialog = new Thread(new Runnable() {
> public void run() {
> new WaitForUserDialog("CCCC", "DDDD").show();
> }
> });
> waitDialog.start();
> }

Regards,
Ghislain Bugnicourt

Le 28 oct. 09 à 14:13, Johannes Schindelin a écrit :

> Hi,
>
> On Wed, 28 Oct 2009, Ghislain BUGNICOURT wrote:
>
>> My goal is to use "WaitForUserDialog" in a plugin that gathers my
>> self-made processes. I tried to simplify my plugin in the attached
>> document ("_Truc", just add ".java" to use). The first occurence of
>> "WaitForUserDialog" works fine. The second one, whithin an
>> "actionPerformed", blocks ImageJ completely.
>
> The actionPerformed() method is called in the event handling  
> thread.  So I
> guess the problem can be fixed by launching the dialog from a newly
> started thread.
>
> Hth,
> Dscho