Configuring IntelliJ IDEA

This tutorial shows how to create a Java project in IntelliJ IDEA, configure it to use JxBrowser, create and run a simple Hello World application.

Creating a New Project

Run IntelliJ IDEA and create a new Java Project:

New Project Step 1 New Project Step 2

Enter Project name and click the Finish button.

New Project Name

Adding JxBrowser JARs

Add JxBrowser JARs to the Java Module dependencies:

Java Module Add Deps Java Module Deps

Creating a Program

Create the HelloWorld class:

New Class New Class Name

Insert the following source code of the HelloWorld example:

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.swing.BrowserView;
import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

public class HelloWorld {

    public static void main(String[] args) {
        // Creating and running Chromium engine
        EngineOptions options =
        Engine engine = Engine.newInstance(options);
        Browser browser = engine.newBrowser();

        SwingUtilities.invokeLater(() -> {
            // Creating Swing component for rendering web content
            // loaded in the given Browser instance.
            BrowserView view = BrowserView.newInstance(browser);

            // Creating and displaying Swing app frame.
            JFrame frame = new JFrame("Hello World");
            // Close Engine and onClose app window
            frame.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
            JTextField addressBar = new JTextField("");
            addressBar.addActionListener(e ->
            frame.add(addressBar, BorderLayout.NORTH);
            frame.add(view, BorderLayout.CENTER);
            frame.setSize(800, 500);


Running the Program

Run the HelloWorld program:

Run Program HelloWorld Program

Go Top