In JxBrowser 5.0 several changes to public API have been introduced. We added support of both Swing and JavaFX UI toolkits, so we had to changed public API to make it compatible with both UI toolkits.


These changes may require changes to your application's source code. This short guide shows how to change your application's source code written with JxBrowser 4.x API to JxBrowser 5.0 API.


Creating Browser

4.x

To create Browser instance in 4.x you use BrowserFactory class: 

Browser browser = BrowserFactory.create();

5.0

In 5.0 the BrowserFactory class has been  removed. To create Browser instance use the following approach: 

Browser browser = new Browser();

Embedding Browser

4.x

To embed Browser component into Swing container the BrowserView class is used. The Browser.getView() method has been removed: 

BrowserView view = browser.getView();
JComponent component = view.getComponent();
frame.add(component, BorderLayout.CENTER);

5.0

In 5.0 to embed Browser component you must use the following approach: 

BrowserView browserView = new BrowserView(browser);
frame.add(browserView, BorderLayout.CENTER);

To embed Browser component into a Swing container use the com.teamdev.jxbrowser.chromium.swing.BrowserView class.


BrowserContext

The Zoom Listener API has been moved from BrowserContext to ZoomService class you can access via BrowserContext.getZoomService() method.

The Network Delegate API has been moved from BrowserContext to NetworkService class you can access via BrowserContext.getNetworkService() method.


Default Handlers

DefaultDialogHandler has been moved to com.teamdev.jxbrowser.chromium.swing.DefaultDialogHandler.

DefaultDownloadHandler has been moved to com.teamdev.jxbrowser.chromium.swing.DefaultDownloadHandler.

DefaultNetworkDelegate has been moved to com.teamdev.jxbrowser.chromium.swing.DefaultNetworkDelegate.

DefaultPopupHandler has been moved to com.teamdev.jxbrowser.chromium.swing.DefaultPopupHandler.

DefaultPrintHandler has been moved to com.teamdev.jxbrowser.chromium.swing.DefaultPrintHandler.

SilentDialogHandler has been removed. Use empty DialogHandler implementation instead.