Re: How to learn to cope with Jrex - are there tutorials out there?
Benjy Cline <benjycline-/[email protected]> Fri, 02 Feb 2007 09:04:46 -0500
| Newsgroups | gmane.comp.mozilla.jrex |
|---|---|
| Message-ID | <[email protected]> |
Billy wrote: > Great thats nice! > But a debugging I noticed webnavi.getDocument doenst seem to work. > It is null all the time. What did I do wrong? Here is my code: > <snip> You shouldn't try to get the DOM until after the document is loaded. In your example, you might try putting the getDocument() call after the Thread.sleep(). I think the purpose of the sleep() is to hope the document is finished loading before you fetch the DOM. A better way, perhaps, is to trigger the getDocument() call on an event. My class that uses JRex implements org.mozilla.jrex.event.progress.ProgressListener. In the onStateChange(ProgressEvent event) method, I test event.isLoadingDocument(). When it is false, I call getDocument(). Regards, Benjy