JxBrowser in Eclipse

  1. Run Eclipse and select a workspace:

    Eclipse Workspace

  2. Create a new Java Project:

    Java Project

  3. Enter the Project name and click the Next button:

    Project Name

  4. Click the Add External JAR… button to add JxBrowser JAR files to the project and click the OK button:

    JxBrowser JAR files

  5. Create the HelloWorld class:

    HelloWorld class

    New Java Class

  6. Insert the following source code of the HelloWorld example:

     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);
  7. Run the HelloWorld program:

    HelloWorld program

    JxBrowser HelloWorld

Go Top