Dears,
I'm working in a JAVAFX application and i have a component called "Disjuntor" which the user can add as many as it wants.
So I have a scene where I can add those elements to a GripPane
.
I created a "fxml template" for the Disjuntor, and intended to call it every time time the user tries to add a new one, filling ti with proper data.
My main scene with the GridPane
highlighted
My disjuntor fxml template
Parent disjuntorPane = null;
Image image = null;
try {
disjuntorPane = FXMLLoader.load(DisjuntorController.class.getResource("disjuntorView.fxml"));
image = new Image (this.getClass().getClassLoader().getResourceAsStream("resource/img/disjuntor.png"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ImageView imageViewComponente = (ImageView) disjuntorPane.lookup("#imageViewComponente");
imageViewComponente.setImage(image);
this.componentesGridPane.add(disjuntorPane, 0, 0);
Once I got the template I'd like to update it with an image.
So trying to use that template seemed very hard, and I'm wondering if I'm going down the wrong path. Is this the way? Are there other possible and better ways to add several panes inside my scene with different data?
Thanks for the help.