I modify a ListView
with the results from a database search in order to use that selection to make another DB request later on.
I want to get the field
Say with list view like this:
ListView listView =new ListView();
Getting selected element from ListView:
listView.getSelectionModel().getSelectedItem();
Tracking (Listening) the changes in list view selection:
listView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue extends String> observable, String oldValue, String newValue) {
System.out.println("ListView selection changed from oldValue = "
+ oldValue + " to newValue = " + newValue);
}
});