-
Bug
-
Resolution: Fixed
-
P4
-
8u20
-
Ubuntu 64,
Java (build 1.8.0_20-ea-b11
Hello,
after adding an Item to a TableView the ChangeListeners are called two times
Look at this code and the output:
TableView<Integer> tv = new TableView<>();
tv.getItems().add(1);
tv.getSelectionModel().select(0);
tv.getSelectionModel().selectedItemProperty()
.addListener(new ChangeListener<Object>() {
@Override
public void changed(
ObservableValue<? extends Object> observable,
Object oldValue, Object newValue) {
System.out.println("OLDVALUE: " + oldValue
+ " NewValue: " + newValue);
}
});
tv.getItems().add(2);
Output:
OLDVALUE: 1 NewValue: null
OLDVALUE: null NewValue: 1
after adding an Item to a TableView the ChangeListeners are called two times
Look at this code and the output:
TableView<Integer> tv = new TableView<>();
tv.getItems().add(1);
tv.getSelectionModel().select(0);
tv.getSelectionModel().selectedItemProperty()
.addListener(new ChangeListener<Object>() {
@Override
public void changed(
ObservableValue<? extends Object> observable,
Object oldValue, Object newValue) {
System.out.println("OLDVALUE: " + oldValue
+ " NewValue: " + newValue);
}
});
tv.getItems().add(2);
Output:
OLDVALUE: 1 NewValue: null
OLDVALUE: null NewValue: 1