Skip to content

Instantly share code, notes, and snippets.

@nickebbutt
Forked from skrb/Test.java
Last active August 29, 2015 14:07
Show Gist options
  • Save nickebbutt/b74cc7f1d40bf5bfa318 to your computer and use it in GitHub Desktop.
Save nickebbutt/b74cc7f1d40bf5bfa318 to your computer and use it in GitHub Desktop.
A simple java app rendering bbc website using JavaFX / WebView and picking up system proxy server settings
package webviewsample;
import java.io.IOException;
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;
public class WebViewTest extends Application {
@Override
public void start(Stage stage) throws Exception {
System.setProperty("java.net.useSystemProxies", "true");
StackPane root = new StackPane();
WebView view = new WebView();
WebEngine engine = view.getEngine();
engine.load("http://www.bbc.co.uk/");
root.getChildren().add(view);
Scene scene = new Scene(root, 800, 600);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) throws IOException {
Application.launch(args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment