javafx on selection change for list view code example
Example: on selected item changed listview javafx
myListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<MyDataModel>() {
@Override
public void changed(ObservableValue<? extends MyDataModel> observable, MyDataModel oldValue, MyDataModel newValue) {
// Your action here
System.out.println("Selected item: " + newValue);
}
});