Re: How to learn to cope with Jrex - are there tutor ials out there?
Billy <florian-lindner-S0/[email protected]> Thu, 1 Feb 2007 15:48:40 +0000 (UTC)
| Newsgroups | gmane.comp.mozilla.jrex |
|---|---|
| Message-ID | <[email protected]> |
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:
public static void main(String[] args) throws JRexException, URISyntaxException {
System.setProperty("jrex.gre.path","C:/mozilla/");
JRexFactory.getInstance().startEngine();
// new winmanager
JRexWindowManager
winManager=(JRexWindowManager)JRexFactory.getInstance()
.getImplInstance(JRexFactory.WINDOW_MANAGER);
// creates a window
winManager.create(JRexWindowManager.SINGLE_WINDOW_MODE);
JPanel inner = new JPanel();
JFrame frame = new JFrame();
frame.getContentPane().add(inner);
winManager.init(inner);
frame.setSize(800,600);
frame.setVisible(true);
JRexCanvas browser =
(JRexCanvas)winManager.getBrowserForRootParent(inner).next();
WebNavigation webnavi = browser.getNavigator();
// call an URI
webnavi.loadURI(new URI("http://www.google.de"),
WebNavigationConstants.LOAD_FLAGS_NONE, null, null, null);
Document doc = webnavi.getDocument()
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
//Element ex = doc.getDocumentElement();
//System.out.println("Current URI: " + webnavi.getCurrentURI());
//util.DOMTraverse.doTree((Node)ex);
}
In fact the browser shows google after the loadURI call.
But the doc is null afterwards... Thx