SpinnerNumberModel 中的 StepSize java
StepSize in SpinnerNumberModel java
我用整数 SpinnerNumberModel
创建了一个微调器。
SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, step);
基于docs.oracle:
stepSize - the difference between elements of the sequence
这到底是什么意思?
Changes the size of the value change computed by the getNextValue and
getPreviousValue methods.
这就像有一个这样的for循环:
for (int i = min; i <= max; i += step)
如果最小值为零且最大值为 10:
步长为1,序列为
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
步长为2,序列为
0, 2, 4, 6, 8, 10
我用整数 SpinnerNumberModel
创建了一个微调器。
SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, step);
基于docs.oracle:
stepSize - the difference between elements of the sequence
这到底是什么意思?
Changes the size of the value change computed by the getNextValue and getPreviousValue methods.
这就像有一个这样的for循环:
for (int i = min; i <= max; i += step)
如果最小值为零且最大值为 10:
步长为1,序列为
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
步长为2,序列为
0, 2, 4, 6, 8, 10