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

Add promptText property in javafx.scene.control.Spinner

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: javafx
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      A DESCRIPTION OF THE REQUEST :
      Currently the control javafx.scene.control.Spinner does not provide a property promptText.

      We need to access its underlying editor in order to modify this display value (prompt text is displayed when the editor text field is empty).



      JUSTIFICATION :
      This would make easier to define Spinner in FXML as we cannot directly modifiy the value of the editor in an FXML file.

      Other controls built ontop of TextField like DatePicker do have a promptText property that work as intended. it is odd that Spinner does not have this property.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Setting the prompText property on the Spinner will change the promptText on the spinner's editor automatically.
      ACTUAL -
      The javafx.scene.control.Spinner does not have a promptText property. We cannot define the promptText of the spinner in FXML.

      CUSTOMER SUBMITTED WORKAROUND :
      The developper can set a promptText on the Spinner by accessing its editor once the FXML has loaded by doing the following in the FXML's controller class:

      public final class MyFormController implements Initializable {

          @FXML
          private Spinner mySpinner;

          @Override
          public void initialize(final URL url, final ResourceBundle bundle) {
              mySpinner.getEditor().setPromptText("Prompt");
          }
      }



        Attachments

          Activity

            People

            Assignee:
            jgiles Jonathan Giles
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: