private void initFooter() { webView.getEngine().load(BuildInfo.instance().getAdUrl()); webView .getEngine() .locationProperty() .addListener( (observable, oldValue, newValue) -> { if (BuildInfo.instance().getAdUrl().equals(oldValue)) { application.getHostServices().showDocument(newValue); } }); final Thread reloadThread = new Thread( () -> { while (true) { try { Thread.sleep(60000); javafx.application.Platform.runLater( () -> { webView.getEngine().reload(); }); } catch (final Exception e) { logger.log(Level.FINE, "Refresh failed", e); } } }, "AdvReloader"); reloadThread.setDaemon(true); reloadThread.start(); }
private void initHeader() { versionLabel.setText(BuildInfo.instance().getFullName()); githubLink.setText(BuildInfo.instance().getRepositoryUrl()); model.checkForUpdate( () -> { javafx.application.Platform.runLater( () -> { versionLabel.setText(BuildInfo.instance().getFullName() + " (UPDATE AVAILABLE!)"); githubLink.setText(BuildInfo.instance().getLatestVersionUrl()); }); }); githubLink.setOnAction( event -> { application.getHostServices().showDocument(githubLink.getText()); githubLink.setVisited(false); }); final Image heartIcon = new Image(getClass().getResourceAsStream("heart.png")); donateLink.setGraphic(new ImageView(heartIcon)); donateLink.setOnAction( event -> { application.getHostServices().showDocument(BuildInfo.instance().getDonateUrl()); donateLink.setVisited(false); }); }