Issue with Generic Dialog

Hi, I’m building a plugin in ImageJ that uses the Generic Dialog to grab information from the user. I have created a jar of my plugin and placed it in the plugins folder so that it shows up in the ImageJ Plugins dropdown. The first time I use the dialog, it works perfectly fine. However, when I try to run it again the ‘Ok’ or ‘Cancel’ buttons do not do anything when I click them. It is only after I exit the dialog that the plugin proceeds with the inputted values. This issue does not occur when I “Compile and Run” the .java file. Has anyone run into this issue before?

For any other people facing the same issue, I found the problem. I have another class that handles the dialog prompts and set it as a singleton design within the run function in the plugin. Apparently ImageJ doesn’t like this because I believe it keeps the classes loaded in memory after the plugin closes. I changed it so that it creates a new dialog object each time in the run function.

You should use the @Parameter annotation rather than GenericDialog.