Java Reference
In-Depth Information
Person oldValue, Person newValue) -> {
if (observable != null &&
observable.getValue() != null) {
teamMembers.clear();
teamMembers.addAll(observable.getValue().employeesProperty());
}
});
root.getChildren().add(gridpane);
primaryStage.setScene(scene);
primaryStage.show();
}
The following code shows the getPeople() method contained in the Work-
ingWithTables main application class. This method populates the UI TableView
control shown previously:
private ObservableList<Person> getPeople() {
ObservableList<Person> people
= FXCollections.<Person>observableArrayList();
Person docX = new Person(“Professor X”, “Charles”,
“Xavier”);
docX.employeesProperty().add(new Person(“Wolverine”,
“James”, “Howlett”));
docX.employeesProperty().add(new Person(“Cyclops”,
“Scott”, “Summers”));
docX.employeesProperty().add(new Person(“Storm”,
“Ororo”, “Munroe”));
Person magneto = new Person(“Magneto”, “Max”,
“Eisenhardt”);
magneto.employeesProperty().add(new
Person(“Juggernaut”, “Cain”, “Marko”));
magneto.employeesProperty().add(new
Person(“Mystique”, “Raven”, “Darkhölme”));
magneto.employeesProperty().add(new
Person(“Sabretooth”, “Victor”, “Creed”));
Search WWH ::




Custom Search