Integrating Chromium into your

Java application

Sebastian Sampaoli on August 30th 2021


If you have worked with an Eclipse RCP or a plain based Java desktop application (like SWT apps), you must have experienced how hard it's to integrate web-based UIs in these kind of apps. Indeed, browser support in Java applications has always been a complicated story.

The lack of a cross-platform engine, the downsides of the existing technologies like JavaFX, and the different rendering experiences that the existing platform-dependant browsers provide, makes it really difficult to bring the web into the desktop Java world. That's why we created Equo Chromium, an open source, modern, cross-platform, performant, and reliable browser implementation which allows developers to create and display web-based UIs in their desktop applications.


Using Equo Chromium to Create Web-based UIs

Using and integrating Equo Chromium in your Java application is as simple as adding an import sentence and instantiating the Equo Chromium browser.

First, add the following import sentence to your Java classes:

import com.equo.chromium.swt.Browser;

Then, you just need to create an instance of the Equo Chromium browser:

import com.equo.chromium.swt.Browser;
public class SinglePagePart {
    public void createBrowser(Composite parent, String url) {
        Browser browser = new Browser(parent, SWT.NONE);
        browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        browser.setUrl(url);
    }
}

That's it. With a few lines of code you can have a modern browser working in all platforms, with the same rendering experiences.

If you want a technology that completely modernize your enterprise desktop application or engineering tool, please check out our SDK here.

Equo

© 2024 Equo Tech, Inc.