JxBrowser 6.0: GPU - Accelerated Rendering

This page will guide you through the major new features and improvements included into JxBrowser 6.


GPU-accelerated rendering


Apart from the standard lightweight (off-screen) rendering mode, now JxBrowser supports heavyweight (windowed, GPU-accelerated) rendering mode. The description of the difference between these two modes is given below.


In lightweight rendering mode Chromium engine renders web page off-screen using CPU. An image of the web page is saved in shared memory. JxBrowser reads the image from the shared memory and displays it using standard Java Graphics 2D API. This approach works great if you need a true lightweight Swing/JavaFX component for display of modern HTML5/JavaScript/CSS web pages.


To create a Browser instance with lightweight rendering mode use the following code:

 

 Browser browser = new Browser(BrowserType.LIGHTWEIGHT);

 

In the heavyweight rendering mode, which is made default mode in JxBrowser 6, we embed a native window into Java frame and configure Chromium engine to render content into this native window using GPU. GPU-accelerated rendering in this case works much faster compared to lightweight rendering mode. In this mode the rendering performance is the same as in Google Chrome, allowing display of full screen video with 60fps.


To create Browser instance with heavyweight rendering mode use the following code:

 

Browser browser = new Browser();
Browser browser = new Browser(BrowserType.HEAVYWEIGHT);

 

JavaScript-Java Bridge

Performance


Transferring data between Java and JavaScript now works ~10 times faster.


JSArray & JSDictionary

In JxBrowser 6 JavaScript-Java Bridge API allows transferring arrays and dictionaries from JavaScript to Java code and vice versa. The following sample demonstrates how to work with JSArray:

 

browser.registerFunction("MyFunction", new BrowserFunction() {
    public JSValue invoke(JSValue... args) {
        // Returns ['Str', 123, true] array
        List array = new ArrayList();
        array.add("Str");
        array.add(123);
        array.add(true);
        return JSValue.create(array);
    }
});


Proxy API


Proxy API has been improved in JxBrowser 6. It now supports HTTP, HTTPS, FTP, and SOCKS protocols. The following sample demonstrates how to work with updated Proxy API:

 

String proxyRules = "http=foo:80;https=foo:80;ftp=foo:80;socks=foo:80";
String exceptions = "<local>";  // bypass proxy server for local web pages
contextParams.setProxyConfig(new CustomProxyConfig(proxyRules, exceptions));

BrowserContextParams contextParams = new BrowserContextParams("chromium-data-dir");
Browser browser = new Browser(new BrowserContext(contextParams));


CJK Input

 


With the heavyweight mode enabled on Mac OS X and Windows, JxBrowser component now allows CJK input, analogous to Google Chrome. Such input is enabled by default.

 

Full list of changes and improvements

  • Heavyweight GPU-accelerated rendering mode has been added.
  • Support of Citrix environment has been added.
  • Support of SOCKS protocol in Proxy functionality has been added.
  • Support of Maven projects has been added. See instruction about how to use JxBrowser in Maven project.
  • The JSArray and JSDictionary types in JavaScript Java Bridge API has been added.
  • JavaScript Java Bridge performance has been improved. Now it works ~10 times faster.
  • Support of passing JSON string to JavaScript side via JavaScript Java Bridge has been added.
  • The NetworkDelegate.onPACScriptError() event has been implemented.
  • Support of Accessibility on Windows and Mac has been implemented [heavyweight, swing, javafx].
  • Support of CJK Input on Windows and Mac has been added [heavyweight, swing, javafx].
  • Support of --disable-direct-write Chromium switcher has been added [heavyweight].
  • Support of SWT environment has been implemented [heavyweight, swing, javafx].
  • Fixed issue with missing Move cursor on Mac [lightweight, swing, javafx].
  • Fixed issue with wrong key codes on Mac [lightweight, swing, javafx].
  • Fixed issue with wrong cursor names in the cursors.properties file [lightweight, swing, javafx].
  • Fixed issue with wrong custom cursor location [lightweight, swing].
  • Fixed issue with incorrect target in DOMEventListener.
  • Fixed issue when video at vimeo.com doesn’t work.
  • Fixed issue when it’s possible to type text when Alt key is pressed [lightweight].
  • Fixed issue when print to PDF fails when pages count is 0.
  • Fixed issue when closing popup with PDF document leads to crash [heavyweight, swing, javafx].
  • Fixed issue when menu item doesn’t dismiss when click BrowserView control [heavyweight, swing, javafx].
  • Fixed deadlock when Browser displays default SSL certificate dialog [heavyweight, swing, javafx].
  • Fixed issue when multiple Browser instances cannot be configured to have their own proxy settings.
  • Fixed NoSuchMethodException on Mac when JxBrowser is used in Java Applet [heavyweight, lightweight, swing, javafx].
  • Fixed NullPointerException in the BrowserPreferences.getDefaultAcceptLanguage() method.
  • Chromium UI language by default is configured according to Java UI language.
  • The Trusted-Library attribute in JAR manifest files has been removed.
  • The debug.log file generation on Windows has been disabled.
  • Symlink for libcrypto.so.1.0.0 on Linux has been added.
  • In case of native crash in Chromium process on Windows, the library generates the jxbrowser-chromium.dmp file and stores it in %localappdata%\JxBrowser directory (e.g. c:\users\<username>\appdata\local\JxBrowser\jxbrowser-chromium.dmp).


Download JxBrowser 6.0