Reputation: 2735
I was wondering if there was a Java swing component that uses webkit. Is it possible to create a webkit browser in Java - must I use JavaFX ?
Upvotes: 15
Views: 31841
Reputation: 2287
You can also look at cross-platform JxBrowser Java library that allows embedding Chromium-based web browser control into Java AWT/Swing application. The library is developer by the company I'm working for.
It supports both Java Swing and JavaFX.
BTW: the browser control is totally lightweight. All rendering happens in a separate native process by native Chromium engine. The web page looks like it's displayed in Google Chrome.
Upvotes: 4
Reputation: 16615
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);
}
}
Upvotes: 4
Reputation: 10629
I develop this browser for my college project may be this helpful for you
My Button is open source java web browser.
Develop for school and college projects and learning purpose. Download source code extract .zip file and copy “mybutton” folder from “parser\mybutton” to C:\
Import project “omtMyButton” in eclipse. Require Java 6.
Download .exe and source code : https://sourceforge.net/projects/omtmybutton/files/
Upvotes: 3
Reputation: 704
SWT has support built-in for GWT, Windows, and OS X. Support for GWT and OS X will probably be less substantial than for Windows.
http://lists.macosforge.org/pipermail/webkit-help/2009-December/000548.html
XULRunner probably has much better API access between Java and the DOM.
Upvotes: -1
Reputation: 17369
There is one in development by Swing Team: http://weblogs.java.net/blog/ixmal/archive/2008/05/introducing_jwe.html
Upvotes: 6