is there a way to change the scene by setOnEndOfMedia
in javafx ? .. i tried this but it's throwing a NullPointerException
void change(Event event){
try{
Node node=(Node) event.getSource();
Stage stage=(Stage) node.getScene().getWindow();
Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("astrolabe/astrolabe_intro.fxml"));/* Exception */
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setFullScreenExitHint("");
stage.show();
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
and calling change()
on end of media like this
astrolabe_intro.setOnEndOfMedia(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
System.out.println("tewst");
Event e = new Event(null) ;
e.fireEvent(astrolabe_intro1, e);
change( e);
}
});