[ImageJ-devel] @Parameter fields - don't make them final
Grant B. Harris
gharris at mbl.edu
Tue May 24 17:07:42 CDT 2011
I discovered the hard way - don't declare @Parameter fields final.
In the GradientImage plugin, the width and height are declared thus:
@Parameter(min = "1")
private final int width = 512;
@Parameter(min = "1")
private final int height = 512;
The input dialog gives you two spinners to change these values. It even
remembers the last values input. But then the plugin uses the initial
final values set when declared... which makes sense. But the input
dialog does not recognize, and there are not warnings that the inputs
will be ignored.
So, if you really want the user to be able to change a parameter, best
to not final !
-- Grant
More information about the ImageJ-devel
mailing list