I am trying to do a WebView that surf websites. When the program is inactive for few seconds, the WebViewwill load back to the beginning of the website.
JavaFXApplication13.java
@Override
public void start(Stage stage) throws IOException {
    Parent root = FXMLLoader.load(getClass().getResource("main.fxml"));
    stage.setScene(new Scene(root));
    stage.show();        
    Duration duration = Duration.seconds(10);
    PauseTransition transition = new PauseTransition(duration);
    transition.setOnFinished(evt -> inactive());
    stage.addEventFilter(InputEvent.ANY, evt -> transition.playFromStart());
    transition.play();
}
private void inactive(){
    //to investigate if it inactive
    System.out.println("Inactive once");   
    //load other website when inactive ?
}
MainController.java
@FXML
WebView webview;
private WebEngine webEngine;
@Override
public void initialize(URL url, ResourceBundle rb) {
    webEngine = webview.getEngine();
    webview.setContextMenuEnabled(false);
    webEngine.load("http://www.google.com");}
This is my main.fxml https://drive.google.com/open?id=1_WnWhkbjaX1s2Y2jI0ojIvc2aQC1njJh
 
    