So, I want to start manipulating elements in a VBox. I'm adding them procedurally with a for loop that loads in fxml rows.
public void scoreRows() {
AtomicInteger rows = new AtomicInteger(1);
for (int i = 0; i <= 10; i++) {
if (rows.get() <=10) {
HBox scoreCellRow = null;
try {
scoreCellRow = FXMLLoader.load(getClass().getResource("/views/score_cell.fxml"));
rowHolder.getChildren().add(scoreCellRow);
} catch (IOException e) {
e.printStackTrace();
}
} else {
System.out.println("No more rows");
}
}
}
As I understand it, each time a row is added a new controller is instantiated. So I'm wondering how do I find these elements to target them. For example, what if I wanted to change the background color of every other row by changing the HBox fx:id cellHolder? Or what if I wanted to change the text in the first box of each row to be sequential Label fx:id roundNum?