I\'d like to have Gecko, WebKit, or another webbrowser embedded in Java as a Swing/AWT control.
I\'m looking for something different than JRex or JWebPane.
JCEF (Java Wrapper for the Chromium Embedded Framework) is a Java wrapper around CEF, which is in turn a wrapper around Chrome:
Both projects seem quite active and the browser rendering is much faster than JavaFX's WebView (at least with JDK 8u20).
It is also possible to use the JavaFX WebView in a Swing application via the JFXPanel.
public class JavaFxWebBrowser extends JFXPanel {
private WebView webView;
private WebEngine webEngine;
public JavaFxWebBrowser() {
Platform.runLater(() -> {
initialiseJavaFXScene();
});
}
private void initialiseJavaFXScene() {
webView = new WebView();
webEngine = webView.getEngine();
webEngine.load("http://stackoverflow.com");
Scene scene = new Scene(webView);
setScene(scene);
}
}