My system consists of a main screen, which has a scroll-pane that I'm populating with a list of other FXML scenes, a code I picked up from an example on the internet, follows the code:
@FXML
private Label label;
@FXML
private VBox pnl_scroll;
@FXML
private void handleButtonAction(MouseEvent event) {
refreshNodes();
}
@Override
public void initialize(URL url, ResourceBundle rb) {
refreshNodes();
}
private void refreshNodes() {
pnl_scroll.getChildren().clear();
Node[] nodes = new Node[15];
for (int i = 0; i < 10; i++) {
try {
nodes[i] = (Node) FXMLLoader.load(getClass().getResource("Item.fxml"));
pnl_scroll.getChildren().add(nodes[i]);
} catch (IOException ex) {
Logger.getLogger(HomeController.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
The problem is, I need to set the data for each item.fxml in scroll-pane before adding them, how can I do that?
Thank you!