Re: How to learn to cope with Jrex - are there tutorials out there?

Benjy Cline <benjycline-/[email protected]> Thu, 08 Feb 2007 08:03:16 -0500
Newsgroups gmane.comp.mozilla.jrex
Message-ID <[email protected]>
Hi, Nico,

Billy had the null pointer problem, so perhaps he'll let us know
if your solution works for him.

Regards,
Benjy

Nicolas Faessel wrote:
> 
> Hi, Benji 
> [snip: you have null pointer when trying to access DOM by getDocument()]
> 
> I would answer for this problem.
> 
> I'm newbie using JRex and I have the same problem : getDocument() always
> returning null pointer.
> 
> I just founded a sample code which works for me. See here :
> 
> http://www.archivesat.com/IQWF_Server/thread1119643.htm
> 
> at the end of the post, there is two class (MyTest & MyProgessListener).
> 
> I made some modification (I don't know if I can put piece of code because it's
> not mine).
> 
> So in class MyTest, I put code in contructor class into main method (because
> constructor didn't was call in main function) and after the line
> winManager.init(null), I create JRex browser and load an URI : 
> 
> 
>       JPanel inner = new JPanel();
>         JFrame frame = new JFrame();
>         
>         frame.getContentPane().add(inner);
> 		
>         frame.setSize(640, 480);
>         frame.setVisible(true);
>         
>         JRexCanvas browser =
>         	(JRexCanvas)winManager.getBrowserForRootParent(inner).next();
> 
>         WebNavigation webnavi = browser.getNavigator();
>         
>         // call an URI
>         try {
>         	webnavi.loadURI(new
> URI("http://www.google.fr"),WebNavigationConstants.LOAD_FLAGS_NONE, null, null,
> null);
> }catch(...    	
> 
> 
> In MyProgressListener, I put a debug print to see if myDoc were null. 
> 
> I don't kwon why it's working here, but I hope it will help you!
> 
> Nico