ImageJ2 Plugin Parameter Styles



Hi All,

I am trying to find a list of all available options for:

@Parameter (style = "???")

I found this page, but there only was one example:


Is there more information somewhere else on the web?


Ideal would be also something that one can “see” from within an java IDE, maybe something like

class WidgetStyles
public final static String[ ] styles = new String[ ]{"directory", "..." };

with all current options, or something similar?! Maybe this exists?

But I could not find it, e.g. here:


And I also would like to ask one more specific question. I am writing an IJ2 plugin for submitting IJ2 commands to a Slurm cluster. For this, the user needs to enter a password for logging into the cluster. Is there a “password style”, which hides the typed text? Or is some other way recommended to get the users credentials?

Best, Christian


very intersting post, thanks for these questions @Christian_Tischer


Each parameter type (e.g. String, Integer, File, etc.) generates its own widget, and the availability of style attributes is defined by each widget implementation. So far (and as things are still being developed), this information is only present in the javadoc of each of the subinterfaces extending InputWidget (see the All Known Subinterfaces section of the InputWidget javadoc).

See here for a list of widget classes in the source repository:

I agree that it’d be useful to have this information somewhere on a centralized page (, I’ll try to add some info there. We should however include links to the sources wherever possible, to minimize the effort of maintaining yet another documentation page, and to avoid that the documentation falls out of date when things update in scijava-common.

Yes, it’s defined in the TextWidget interface:

so in Java, you’d use it as:

@Parameter (style = TextWidget.PASSWORD_STYLE)
private String pwd;


@ctrueden, Thank you very much for this very helpful answer!!


Do you mean “@imagejan Thank you”? :wink: If so, seconded! :smile:


Yes! Sorry!
@imagejan: Thank you!


@ctrueden @imagejan
I started reading a bit about security and it seems like that returning a char[ ] rather than a String is believed to be more secure (see below).

I am bringing this up, because - as mentioned above - I am developing a “RunImageJ2CommandOnSlurmCluster” plugin, which I believe is very useful to have.

However, to use this service the users need to enter their full credentials into the plugin, because I am using JSch for establishing an SSH connection to the cluster.

Thus, I am worried in terms of doing things as safe as possible.

What are your opinons/recommendations about this?

getPassword from UI

I agree that it would be nice to be able to annotate @Parameter char[] str and have that use a text widget. But I expect it does not work, currently. It will work in the next generation of the widget framework design, which no longer uses generics to constrain the types. A String or any CharSequence or char[] parameter should all be able to use the same text widget, without any convoluted shenanigans.