1myListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<MyDataModel>() {
2
3 @Override
4 public void changed(ObservableValue<? extends MyDataModel> observable, MyDataModel oldValue, MyDataModel newValue) {
5 // Your action here
6 System.out.println("Selected item: " + newValue);
7 }
8});
9