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

TextField with unexpected behavior in textProperty

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: fx2.0
    • Fix Version/s: fx2.1
    • Component/s: javafx
    • Labels:

      Description

      Add a listener in textProperty, when there is a change in text, verify if the same is valid, if invalid set empty in text.

      see:

      textProperty().addListener(new ChangeListener<String>() {
          private boolean inProgress;
          @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
              if (inProgress) {
                  return;
              }
              inProgress = true;
              try {
                  thow new Exception(); //here logic code for validation
              } catch (ParseException e) {
                  setText("");
              }
              inProgress = false;
          }
      });


      In the case above the TextField should be always empty.

      But it's not what happens. Always gets a letter.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mheinrichs Michael Heinrichs (Inactive)
                Reporter:
                gstiwesjfx giovanni stiwes (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: