katr_s
New Coder
I'm trying to make a scene where a user can open a certain movie. Any ideas how can I put this in a loop so it works for all the movies not just one?
Java:
@FXML
public void Movie1Click(MouseEvent event) throws IOException {
String[] movieTitleArray = Movie1.getImage().getUrl().split("/");
String movieTitle = movieTitleArray[movieTitleArray.length - 1];
for (Movie temp : MainService.allMovies) {
if ((temp.getMovieTitle() + ".jpg").equals(movieTitle)) {
movie = temp;
root = FXMLLoader.load(getClass().getResource("/SelectedMovie.fxml"));
stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
scene = new Scene(root);
stage.setScene(scene);
stage.show();
Last edited by a moderator: