Skip to content

Commit 7e1893a

Browse files
authored
Update parameters.md
Mention scijava-ui-swing improvement on number formatting done by @imagejan in scijava/scijava-ui-swing#54
1 parent 10badb6 commit 7e1893a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

_pages/scripting/parameters.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,26 @@ Different styles are also possible.
7373

7474
<img src="/media/scripting/scriptparameters-integerstyles.jpg" width="450"/>
7575

76+
It is also possible to specify a format with a fixed number of decimals...
77+
```javascript
78+
// Specified format
79+
#@ Double (value=0.0123, persist=false, style="format:#.##") i
80+
#@ Double (value=0.0123, persist=false, style="format:#.00") j
81+
#@ Double (value=123.45, persist=false, style="format:#####.#####") k
82+
#@ Double (value=123.45, persist=false, style="format:00000.00000") l
83+
```
84+
85+
... in combination with slider or scrollbars:
86+
```
87+
// Sliders and scroll bars
88+
#@ Double (value=1, min=0, max=10, stepSize=0.001, persist=false, style=slider) m
89+
#@ Double (value=1, min=0, max=10, stepSize=0.001, persist=false, style="slider,format:0.0000") n
90+
#@ Double (value=1, min=0, max=10, stepSize=0.001, persist=false, style="scroll bar") o
91+
#@ Double (value=1, min=0, max=10, stepSize=0.001, persist=false, style="scroll bar,format:0.0000") p
92+
```
93+
94+
Scientific notation can be specified with `format:0.#####E0`
95+
7696
## Parameter properties
7797

7898
If you look at the [@Parameter annotation](https://github.com/scijava/scijava-common/blob/scijava-common-2.40.0/src/main/java/org/scijava/plugin/Parameter.java), you will notice it has many properties—for example, `name` and `description`.

0 commit comments

Comments
 (0)