I have a list of records and 2 types of TextField
s: filled and empty. I am putting these in a VBox
.
for (int i = 0; i < records.size(); i++) {
if (records.get(i).contains("NEW")) {
TextField fillField = new TextField();
vbox.getChildren().add(fillField);
} else {
TextField filledField = new TextField();
filledField.setEditable(false);
filledField.setText(records.get(i));
vbox.getChildren().add(filledField);
}
}
After this the user can fill in the free TextField
s. How can I update them inside the VBox
?
Then I want to check if any of them are empty(how?), in which case I will fill them with "true"
.
EDIT: So I am doing this:
for (int i = 0; i < vbox.getChildren().size(); i++) {
if (((TextField) vbox.getChildren().get(i)).getText()==null) {
TextField filledField = new TextField("true");
((TextField) vbox.getChildren().get(i)).setText("true");
//System.out.println(((TextField)vbox.getChildren().get(i)).getText());
}
}
My problem is that when I am printing in the console, I do see true
when the field is empty. But in my application, the field remains empty.
Do I need to update vbox or something, after I update all the fields or?