Non modal radio button dialog in macro

Tags: #<Tag:0x00007fd542b8efd8>


I would like to create a non modal dialog within the ImageJ macro language, and add radio buttons to it as with the currently existing Dialog functions.

Digging around I noticed there is a NonBlockingGenericDialog class:

Does anyone know how I might access this class through the macro language? Or perhaps point me in the right direction for writing and using a custom plugin in the macro language?


Good day David,

did you have a look at:

call(“class.method”, arg1, arg2, …)
Calls a public static method in a Java class, passing an arbitrary number of string arguments, and returning a string. Refer to the CallJavaDemo macro and the ImpProps plugin for examples. Note that the call() function does not work when ImageJ is running as an unsigned applet.




I fear this will not work for @dmd, as the call method only allows to call public static methods, and only if they have only String parameters.

If you want to directly use the Java API of the NonBlockingGenericDialog class, I think you’ll have to use a full-fledged scripting language, e.g. Groovy:

import ij.gui.NonBlockingGenericDialog

dialog = new NonBlockingGenericDialog("Dialog")
dialog.addRadioButtonGroup("Choice", ["A", "B", "C"] as String[], 1, 3, "A")


Thanks for the answers folks. Looking at the “call” inbuilt function was what got me digging, @Herbie. Unfortunately, I concur with @imagejan that it will not be possible to call a non static public method (and I have tried, but I got an error each time along the lines of failure to import class).

@imagejan, with your solution would I have to rewrite my extensive macro—which only uses Image J built in functions—in Groovy? I was wondering if I could produce my own plugin and call it from the IJ macro language somehow?
Thanks again, everyone!