Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8185937

Spinner with Double/Integer value factory ignores up/down arrow keys

XMLWordPrintable

    • x86
    • other

      FULL PRODUCT VERSION :
      C:\Program Files\Java\jdk1.8.0_102\bin>java -version
      java version "1.8.0_102"
      Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      C:\Windows\System32>ver

      Microsoft Windows [Version 10.0.15063]

      A DESCRIPTION OF THE PROBLEM :
      In Java 8u40 the Spinner control was updated to accept the arrow keys for cycling elements. This functionality does not appear to work with numbers when the spinner is editable. Editable spinners in Swing do work with the up and down arrow keys from my testing.

      The following StackOverflow post indicates the problem:
      https://stackoverflow.com/questions/30597345/how-to-enabled-up-down-keys-in-a-javafx-spinner-component

      The documentation for Spinner states "The keyboard up/down arrow keys also cycle through the elements."

      https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/Spinner.html

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a Spinner with an Integer or Double value factory that has the property editable="true".
      2. Focus the Spinner and press the up and down arrow keys on the keyboard.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The Spinner would increment/decrement accordingly.
      ACTUAL -
      The Spinner does not change and the cursor is moved left to the beginning of the field.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Declare a custom event listener as demonstrated in the StackOverflow answer.

            swpalmer Scott Palmer
            webbuggrp Webbug Group
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: