/ Published in: Java
don't forget to add jfxrt.jar to class path
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package main; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; import javafx.stage.Stage; /** * * @web http://java-buddy.blogspot.com/ */ /** * @param args the command line arguments */ launch(args); } @Override public void start(Stage primaryStage) { primaryStage.setTitle("facebook.com"); WebView myBrowser = new WebView(); WebEngine myWebEngine = myBrowser.getEngine(); myWebEngine.load("https://google.com"); StackPane root = new StackPane(); root.getChildren().add(myBrowser); primaryStage.setScene(new Scene(root, 640, 480)); primaryStage.show(); } }