This is about the minimum to get the mozilla dom:
Thanks to Miroslav Penkov and cancandan

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.MozillaBrowser;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.mozilla.xpcom.nsIDOMDocument;

public class Test {
        public static void main(String args[]) {
                Display display = new Display();
                Shell shell = new Shell(display);

final MozillaBrowser browser = new MozillaBrowser(shell,WT.BORDER);
                browser.setUrl("http://www.google.com";);
                browser.addProgressListener(new ProgressListener() {
                        public void changed(ProgressEvent event) {
                        }

                        public void completed(ProgressEvent event) {
                            nsIDOMDocument doc = browser.getDocument();
                                System.out.println(doc);
                        }
                });

                while (!shell.isDisposed()) {
                        if (!display.readAndDispatch()) {
                                display.sleep();
                        }
                }
        }

[EMAIL PROTECTED] escribió:
Marcus wrote:
[EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
Hey guys.  I'm trying to embed mozilla with java for a data gathering
tool.  I don't actually need any visual elements--I just need to access
the DOM and load URLs with the browser.  Regardless... I just can't
figure out how to embed mozilla.  I am currently having trouble
understanding how to implement the browser chrome as well as other
interfaces so that my program actually works.  What I would really like
to see is a very simple example in java of how someone would embed
mozilla.

Thanks guys,

Andy
I'm really on the verge of giving up.  I can't find any good examples
of how to embed mozilla using java.  All of the code I find is
fragmented or doesn't work.  Any help would be appreciated.

you may take a look to the atf project of eclipse
http://www.eclipse.org/atf/

Thanks.  I just tried to make a stripped down version using their code
to no avail though.  It's giving me errors when trying to add the
progress listener and when trying to call loadURI on the web nav class.

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to