i have made some person class objects i'm printing their variable properties by using ObserveableList and calling it in initialize method the problem is i am not getting it how can i print each object separately, these are printed as whole i want to iterate through one-by-one
Person p1 = new Person("1001", "person1", "11");
Person p2 = new Person("1002", "person2", "12");
Person p3 = new Person("1003", "person3", "13");
Person p4 = new Person("1004", "person4", "14");
ObservableList<Person> personDataTable = FXCollections.observableArrayList(p1, p2, p3, p4);
@Override
public void initialize(URL location, ResourceBundle resources) {
printTable();
}
public void printTable() {
tableID.setCellValueFactory(new PropertyValueFactory<Person, String>("id"));
tableName.setCellValueFactory(new PropertyValueFactory<Person, String>("name"));
tableAge.setCellValueFactory(new PropertyValueFactory<Person, String>("age"));
tableView.setItems(personDataTable);
}
To clarify, you want to add one person to the table, wait a second, add the next person, wait another second, add the next person, and so on, correct? yes, exactly (i can't reply to comment)