I've been using JavaFx lately, as a beginner, and have been very impressed. At the moment I'm stuck trying to set a pagination slideshow to automatically move the slideshow forward every 5 seconds (and back to the first slide to continue when the last slide is reached). Can any one steer me in the right direction here?
@FXML
public void slideshow(ActionEvent event) {
// TODO Auto-generated method stub
String[] photos = { "housestark.jpg", "housefrey.jpg", "housebar.jpg",
"HouseBolton.jpg", "housegreyjoy.jpg", "houseaaryn.jpg",
"houselannis.jpg", "housemart.jpg", "housereed.jpg",
"housetully.jpg", "housetyrel.jpg", };
Pagination p = new Pagination(photos.length);
p.setPageFactory((Integer pageIndex) -> {
return new ImageView(getClass().getResource(photos[pageIndex])
.toExternalForm());
});
Stage stage = new Stage();
stage.setScene(new Scene(p));
stage.setX(1250);
stage.setY(10);
stage.setTitle("Slideshow");
stage.setResizable(false);
stage.show();
}
This is my code so far! I would appreciate any help anyone could give?