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

SelectionModel.selectedIndex change listener always returns old value as -1

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 8
    • fx2.0
    • javafx

      Try using a callback such as the following, and observe that the old value is always -1

      listView.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
          public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
              System.out.println("change listener: " + t + " -> " + t1);
          }
      });

      Workaround: Developer can locally record the old value of the selected index within the ChangeListener anonymous inner class.

            jgiles Jonathan Giles
            jgiles Jonathan Giles
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: