开发者

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 s开发者_如何转开发erver 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 ?


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

See here.


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


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


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");
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜