Show website in Processing Java app

The following must be run in Processing 3.5.4. Current editor only has JavaFX renderer and not all the requisite libraries apparently.

// Must be run in Processing 3.5.4

import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebView;

void setup() {  
  size(100, 100, FX2D);  // Creates default window in addition to one below.
  Stage stage = new Stage();
  stage.setTitle("JavaFX WebView Example");
  WebView webView = new WebView();
  webView.getEngine().load("http://google.com");
  VBox vBox = new VBox(webView);
  Scene scene = new Scene(vBox, 960, 600);
  stage.setScene(scene);
  stage.show();
}

void draw() {
}

More info here: https://discourse.processing.org/t/how-to-use-javafx-in-processing-4/35842

4 Likes