JxBrowser 5.0 introduces several changes to the public API. This short guide shows how to change your application code written with JxBrowser v4.x to work with v5.0.

In v5.0 We added support of both Swing and JavaFX UI toolkits. So we had to change the public API to make it compatible with both UI toolkits.

These changes may require changes to the source code of your application.

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

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

5.0

In 5.0 to embed Browser component 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 and can be accessed via BrowserContext.getZoomService() method.

The Network Delegate API has been moved from BrowserContext to NetworkService class and can be accessed 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.

Go Top