Note: Advice in this article will only work for JxBrowser 6. See the corresponding article for JxBrowser 7 here.(注意:本文中的建议仅适用于JxBrowser6,JxBrowser7相应文章请点击这里。)

1. Run IntelliJ IDEA and create a new Java Project: (运行IntelliJ IDEA并创建一个新的Java项目)

2. Enter Project name and click the Finish button.  (输入项目名称,然后单击完成按钮)


3.   Add libraries to the Java Module dependencies list:(将库添加到Java模块依赖项列表)

4.  Create  HelloWorld  class:(创建HelloWorld类)



5. Insert the following source code of the  HelloWorld  example:(编写HelloWorld示例的源代码)
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

 * The sample demonstrates how to create Browser instance, embed it, display and load
 * specified URL.
public class HelloWorld {
    public static void main(String[] args) {
        final Browser browser = new Browser();
        BrowserView view = new BrowserView(browser);

        final JTextField addressBar = new JTextField(
        addressBar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

        JPanel addressPane = new JPanel(new BorderLayout());
        addressPane.add(new JLabel(" URL: "), BorderLayout.WEST);
        addressPane.add(addressBar, BorderLayout.CENTER);

        JFrame frame = new JFrame("JxBrowser - Hello World");
        frame.add(addressPane, BorderLayout.NORTH);
        frame.add(view, BorderLayout.CENTER);
        frame.setSize(800, 500);



6. Run the HelloWorld program:(6.运行HelloWorld程序:)