I'm still pretty new to this so I did quite a reseach but couldn't found any suitable solution on SO or on the interet. How can I create multiple instances of object (you can call it a factory) based on one .fxml
file.
This particular .fxml
file represents one record of movie information. And the result looks similar to this (I won't post here the fxml code, because it's not relevant):
So this is one record. As you can see I need sort of template. Let's say I got to display information about 5 movies, so I wish I could do :
MovieView movieView = new MovieView(name, imageUrl, year, List<String> directors,
List<String> actors, Integer boxOffice, reviews);
movieView.setImage(new Image(...)); // image change
vbox.getChildren().add(movieView); // append to main panel
five times and fill the VBox with five instances of the same class MovieView. How can this be done?