Script Parameters... increasing decimal places for #@Double

Perhaps this is a stupid question… but does anyone know how I can set the number of decimal places for a persisted value of a #@Double Script Parameter?

Is it even possible?

I’m asking… because for example - I want to display the a default value of 0.0178 in my dialog for a user…

#@Double(label="Distance", value=0.01780, persist=false) distance

However, when the code runs… I get a pre-set value of 0.018 popping up.

What am I missing - if anything?!


1 Like

I’d consider this a bug in scijava-ui-swing. The spinner created in SwingNumberWidget is using the default DecimalFormat which apparently has a maximum of three decimal places.

You can somehow work around the issue by using a slider or scroll bar (within a defined range). But while the actual values can contain more decimal places (as shown by the println statement, there’s still no visual feedback inside the spinner text field:

#@ Double (label="Distance", min=0, max=0.05, value=0.01780, persist=false, stepSize=0.0001, style=slider) distance
println distance

Would you mind submitting an issue to scijava-ui-swing? There’s no parameter attribute for number formats, but we could maybe use the style attribute for this; in any case we should try to guess a suitable spinner number format from the combination of min, max and stepSize, or from the default value


Thanks so much @imagejan !!! I’m on it… will post a link here once the issue is submitted.

You are the best!

eta :slight_smile:

Issue has been submitted: