Posted on May 15, 2020

We are excited to introduce you JxBrowser 7.7! This update is a new spin in the history of the library. In this version we introduce the pure SWT BrowserView control for the SWT/Eclipse RCP applications.

What’s New

SWT

The library now provides the pure SWT com.teamdev.jxbrowser.view.swt.BrowserView control that can be embedded into the SWT/Eclipse RCP applications.

Here is a simple example that demonstrates how to use the SWT BrowserView in a simple SWT application:

import static com.teamdev.jxbrowser.engine.RenderingMode.HARDWARE_ACCELERATED;

import com.teamdev.jxbrowser.browser.Browser;
import com.teamdev.jxbrowser.engine.Engine;
import com.teamdev.jxbrowser.engine.EngineOptions;
import com.teamdev.jxbrowser.view.swt.BrowserView;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public final class HelloWorld {

    public static void main(String[] args) {
        // Creating and running Chromium engine
        Engine engine = Engine.newInstance(
                EngineOptions.newBuilder(HARDWARE_ACCELERATED).build());

        Browser browser = engine.newBrowser();
        // Loading the required web page
        browser.navigation().loadUrl("https://html5test.com");

        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setText("JxBrowser SWT");
        shell.setLayout(new FillLayout());

        // Creating SWT component for rendering web content loaded 
        // in the Browser instance
        BrowserView view = BrowserView.newInstance(shell, browser);
        view.setSize(800, 600);

        shell.pack();
        shell.open();

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        // Closing the engine and releasing all allocated resources
        engine.close();
        
        display.dispose();
    }
}

JxBrowser SWT Example

Eclipse RCP

The SWT toolkit is often used in Eclipse RCP applications, so we prepared a short tutorial describing how to use the JxBrowser SWT BrowserView in an Eclipse RCP application.

JsFunction

The JsFunction class has been restored in the JavaScript-Java Bridge API. Now you can work with the JavaScript functions directly from the Java code and pass the reference to a function from JavaScript to Java and vice versa. For example:

JsObject window = frame.executeJavaScript("window");
if (window != null) {
    JsFunction alert = frame.executeJavaScript("window.alert");
    if (alert != null) {
        alert.invoke(window, "Hello world!");
    }
}

Improvements

  • The web pages are now being loaded two times faster, than in the previous versions due to the improvements in the loading time and the memory usage in the Chromium processes.
  • JxBrowser now supports Firebase Cloud Messaging.
  • The WebAssembly support is added.
  • With this version you can render the HTML <datalist> tag on the web pages.
  • The web form autofill functionality is now disabled by default.
  • You can now drag and drop files, images, text to and from the Swing/JavaFX BrowserView component on Linux, since the Drag and Drop functionality limitations in both rendering modes have been removed.
  • Since JxBrowser only supports the 64-bit version of Linux, it now throws an exception, upon an attempt to be run on Linux 32-bit. This is done by the new Environment.checkEnvironment() method responsible for detecting this unsupported environment.

Fixed issues

  • The Swing BrowserView component not being visible when embedded into javax.swing.JApplet when the hardware accelerated rendering mode is enabled.
  • The internal test resources excluded from the JAR files.
  • Setting focus to Swing BrowserView via mouse click not clearing the focus from the currently focused Swing component on Windows.
  • The IllegalArgumentException error when displaying Swing BrowserView in the hardware accelerated rendering mode on Windows.
  • Double content rendering when Swing BrowserView is embedded into JScrollPane in the off-screen rendering mode on Windows.
  • Freeze on closing Browser during active repainting on the loaded web page in the off-screen rendering mode.
  • Swing application not receiving focus after clicking the JavaFX BrowserView embedded into JFXPanel in the hardware accelerated rendering mode on Windows.
  • Google reCAPTCHA not receiving focus via the Tab key.
  • The inability to type anything in the text fields located inside an IFRAME on a web page in the off-screen rendering mode.
  • Closing the window where the BrowserView component is embedded leading to closing all Browser instances in the off-screen rendering mode on Windows.
  • Freeze on closing Engine in the off-screen rendering mode on Windows and Linux because of timings.
  • Freeze on closing Engine after unsubscribing from getting the BrowserClosed events on Windows and Linux.
  • Chromium crash when loading the chrome://settings web page. This web page is disabled now.
  • The ClassCastException error when the Swing BrowserView component is embedded into JDialog and file download has been initiated.
  • A single-pixel white vertical line in the fullscreen mode on Linux in the hardware accelerated rendering mode.
  • Chromium log files being created in the directory with the Chromium binaries on macOS when the engine has crashed or unexpectedly terminated.
  • The white angles inside the BrowserView component on Ubuntu in the hardware accelerated rendering mode.

Request evaluation license
Download JxBrowser 7.7

Go Top