14

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 ?

just_a_dude
  • 2,745
  • 2
  • 26
  • 30

5 Answers5

6

There is one in development by Swing Team: http://weblogs.java.net/blog/ixmal/archive/2008/05/introducing_jwe.html

Eugene Ryzhikov
  • 17,131
  • 3
  • 38
  • 60
4

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.

Vladimir
  • 1
  • 1
  • 23
  • 30
4

JCEF

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).

JFXPanel

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);
    }
}
Community
  • 1
  • 1
Luke Quinane
  • 16,447
  • 13
  • 69
  • 88
3

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/

Dhiral Pandya
  • 10,311
  • 4
  • 47
  • 47
-1

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.

dt.
  • 704
  • 8
  • 14