Skip to content

Instantly share code, notes, and snippets.

@julianjupiter
Created June 1, 2018 12:31
Show Gist options
  • Select an option

  • Save julianjupiter/4c5aca2185aef494cb4d12a295bddec3 to your computer and use it in GitHub Desktop.

Select an option

Save julianjupiter/4c5aca2185aef494cb4d12a295bddec3 to your computer and use it in GitHub Desktop.
Basic example of JavaFX WebView
package io.github.julianjupiter.jblog;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class JavaFXWebView extends Application {
@Override
public void start(Stage stage) {
stage.setTitle("Julian Jupiter GitHub Pages");
stage.setWidth(500);
stage.setHeight(500);
Scene scene = new Scene(new Group());
VBox root = new VBox();
final WebView browser = new WebView();
final WebEngine webEngine = browser.getEngine();
webEngine.load("http://julianjupiter.github.io/");
root.getChildren().addAll(browser);
scene.setRoot(root);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment