Created
June 1, 2018 12:31
-
-
Save julianjupiter/4c5aca2185aef494cb4d12a295bddec3 to your computer and use it in GitHub Desktop.
Basic example of JavaFX WebView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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