Grupy dyskusyjne Google nie obsługują już nowych postów ani subskrypcji z Usenetu. Treści historyczne nadal będą dostępne.

Difficulty embedding mozilla using java

128 wyświetleń
Przejdź do pierwszej nieodczytanej wiadomości

scott...@gmail.com

nieprzeczytany,
1 paź 2006, 22:09:511.10.2006
do
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

scott...@gmail.com

nieprzeczytany,
2 paź 2006, 01:25:342.10.2006
do

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.

Marcus

nieprzeczytany,
2 paź 2006, 01:42:432.10.2006
do
you may take a look to the atf project of eclipse
http://www.eclipse.org/atf/

scott...@gmail.com

nieprzeczytany,
2 paź 2006, 11:53:272.10.2006
do

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.

Micael Gallego Carrillo

nieprzeczytany,
2 paź 2006, 19:24:392.10.2006
do
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();
}
}
}

scott...@gmail.com escribió:

scott...@gmail.com

nieprzeczytany,
4 paź 2006, 20:01:054.10.2006
do
Is there any way to do that without having a GUI?

Ben Hutchings

nieprzeczytany,
7 paź 2006, 18:38:037.10.2006
do
<scott...@gmail.com> wrote:
> Is there any way to do that without having a GUI?

The browser is inherently a GUI component. However, if the underlying
GUI supports some kind of off-screen or hidden window, then the browser
can probably be made to use that. Under Linux I'm using Xvfb (X virtual
frame buffer server) to run the browser without a real display.

Ben.

--
Ben Hutchings -- b...@decadentplace.org.uk shortened to b...@decadent.org.uk
If you've signed my GPG key, please send a signature on and to the new uid.
I'm not a reverse psychological virus. Please don't copy me into your sig.

Andy Scott

nieprzeczytany,
7 paź 2006, 19:44:417.10.2006
do
Yes, that is true. But I have read that it is possible to implement
the window classes so that there is no rendered GUI. How do to do this
I don't know.
Nowe wiadomości: 0