bad TableView example in the tutorial
Henning Brackmann
henning.brackmann at scoop-software.de
Thu Jul 23 11:35:21 UTC 2015
https://docs.oracle.com/javase/8/javafx/user-interface-tutorial/table-view
.htm
Why are the SimpleStringProperties in the person class private?
IMHO the Person class should be:
Example 13-3 Creating the Person Class
public static class Person {
public final SimpleStringProperty firstName;
public final SimpleStringProperty lastName;
public final SimpleStringProperty email;
private Person(String fName, String lName, String email) {
this.firstName = new SimpleStringProperty(fName);
this.lastName = new SimpleStringProperty(lName);
this.email = new SimpleStringProperty(email);
}
}
Example 13-5 Setting Data Properties to Columns
firstNameCol. setCellValueFactory(param -> param.getValue().firstName);
lastNameCol.setCellValueFactory(param -> param.getValue().lastName);
emailCol.setCellValueFactory(param -> param.getValue().email);
I think the tuturial should promote typesafe bindings.
Best regards!
Henning
More information about the openjfx-dev
mailing list