Jhon
Jhon

Reputation: 433

Best way to integrate Browser into Java application

I designing a Java desktop app which will open web page, allow user to login via web and analyse web server results.

So far I can see SWT browser's implementation but is not supported on 64 bit, maybe exist another implementation of browser bindings for Java ?

Upvotes: 5

Views: 2535

Answers (4)

Vladimir
Vladimir

Reputation: 2257

You can take a look at JxBrowser library that allows integrating Chromium-based WebBrowser control into Java Swing/JavaFX application on Windows, Linux and Mac OS X. The following sample shows how to integrates Browser component into JFrame:

import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;

import javax.swing.*;
import java.awt.*;

/**
 * This sample demonstrates how to create Browser instance,
 * embed it into Swing BrowserView container, display it in JFrame and
 * navigate to the "www.google.com" web site.
 */
public class BrowserSample {
    public static void main(String[] args) {
        Browser browser = new Browser();
        BrowserView browserView = new BrowserView(browser);

        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.add(browserView, BorderLayout.CENTER);
        frame.setSize(700, 500);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);

        browser.loadURL("http://www.google.com");
    }
}

Upvotes: 0

Wivani
Wivani

Reputation: 2046

Think about using Eclipse as 'Rich Client'. You'll have no trouble using the internal browser that comes with it.

See here.

Upvotes: 3

Nick H
Nick H

Reputation: 11535

JavaFX comes with an embedded browser. You may be able to make use of it without having to use the JavaFX script language.

http://download.oracle.com/javafx/2.0/webview/jfxpub-webview.htm

Upvotes: 1

Charlee Chitsuk
Charlee Chitsuk

Reputation: 9059

The Eclipse SWT support both of 32bits, 64Bits and too many platforms. e.g Windows, Linux, Mac and AIX. You may see further information at the download page as

http://download.eclipse.org/eclipse/downloads/drops/R-3.7-201106131736/index.php#SWT

Upvotes: 1

Related Questions