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

ListView: selection model issue

XMLWordPrintable

      Selection model's getSelectedItem() returns old data item after setting new item:
              list = new ListView<Integer>();
              ArrayList<Integer> data1 = new ArrayList<Integer>();
              data1.add(new Integer(1));
              list.setItems(FXCollections.observableList(data1));
              list.getSelectionModel().select(0);
              System.out.println(list.getSelectionModel().getSelectedItem());
              ArrayList<Integer> data2 = new ArrayList<Integer>();
              data2.add(new Integer(2));
              list.setItems(FXCollections.observableList(data2));
              System.out.println(list.getSelectionModel().getSelectedItem());

            jgiles Jonathan Giles
            ogb Oleg Barbashov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: