RFR: 8242553: IntegerSpinner and DoubleSpinner do not wrap around values correctly in some cases

Andy Goryachev angorya at openjdk.org
Tue Mar 26 21:34:24 UTC 2024


On Sun, 24 Mar 2024 15:11:16 GMT, drmarmac <duke at openjdk.org> wrote:

> This PR should fix the issue and cover all relevant cases with new tests.
> 
> Note: This involves a small behavior change, as can be seen in dblSpinner_testWrapAround_decrement_twoSteps() in SpinnerTest.java:749. With this change the wraparound behavior is similar to that of the IntegerSpinner.

> * Use modulo arithmetic to compute the value (what this PR proposed)
> * Don't process the increment at all (i.e., treat it as an out-of-range request and do nothing)

3. fall back to  amountToStepBy=1

try this: integer spinner, min=0. max=100, step=137.  initial value 50
there is the sequence when repeatedly pressing arrow down button:
14, 79, 43, 7, 72, 36, 0, ...

makes no sense.

falling back to step=1:

49, 48, 47, 46, ...

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1431#issuecomment-2021511249


More information about the openjfx-dev mailing list