Re: Embedding Mozilla with JavaXPCOM and AWT/Swing

Greg Bowyer <[email protected]> Mon, 16 Jul 2007 15:27:30 +0100
Newsgroups gmane.comp.mozilla.devel.java
Message-ID <t9mdncVpL8GbHAbbnZ2dnUVZ_veinZ2d__26654.4972816066$1184596522$gmane$org@mozilla.org>
You can always have xulrunner powering the GUI as it sees fit, and call 
back into java via JavaXPCom

An alternative might be to look at SWT and how the eclipse folk are 
doing xulrunner integration as this will work in all the major platforms 
(ala 
http://javier.pedemonte.us/blog/2007/05/22/mozilla-everywhere-in-swt-33/)

As far as I am aware you *only* need to use JNI if you need to handroll 
the integration to the windowing / widget library yourself
Sylvain Ferriol wrote:
> Julien1311 wrote:
>> Thanks for your help.
>> Actually, I'm looking for something which could work on all the OS 
>> supported
>> by XULRunner. I didn't manage to find any example but some 
>> explanations on
>> the fact that I should use JNI.
>>
>> Could you explain why this code only works on Windows?
> because under linux, swing uses X11 library but xulrunner uses GTK 
> library. So xulrunner needs a GTK window ID as parent window, not X11 
> window ID otherwise it crashs
>> Is there somebody who has some other examples which could help me?
>>
>> Thanks
>>
>>
>> Sylvain Ferriol wrote:
>>> Julien1311 wrote:
>>>> Hi everybody,
>>> hi julien
>>>> I'm trying to embed XULRunner into my Java application using JavaXPCOM.
>>>> It
>>>> seems really complicated for me. Is there someone who has already tried
>>>> to
>>>> do such a thing and who could give me its sources or a link toward an
>>>> example of embedded browser with AWT/Swing ? At least, for the JNI 
>>>> part.
>>>>
>>> you do not have to use jni, i attach my code for using javaXPCOM 
>>> using Swing but it works only under windows :(
>>>
>>> this code works with xulrunner 1.9
>>>
>>> an example for using JWeb class:
>>>
>>>     File grePath = new File("src/lib/xulrunner");
>>>     
>>>     JWeb.start(grePath.getAbsolutePath());
>>>     jweb = new JWeb();
>>>     
>>>     JFrame frame = new JFrame();
>>>     JPanel panel = new JPanel();
>>>     panel.setLayout(new BorderLayout());
>>>     panel.add(jweb, BorderLayout.CENTER);
>>>     frame.getContentPane().add(panel);
>>>
>>>             frame.setVisible(true);
>>>
>>>     nsIWebProgress webProgress = (nsIWebProgress) 
>>> jweb.getInterface(nsIWebProgress.NS_IWEBPROGRESS_IID);
>>>     nsIWebNavigation webNavigation = (nsIWebNavigation) 
>>> jweb.getInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID);
>>>
>>>     WebProgressListener aWebProgressListener = new 
>>> WebProgressListener();
>>>     webProgress.addProgressListener(aWebProgressListener,
>>>                  nsIWebProgress.NOTIFY_ALL);
>>>     webNavigation.loadURI("http://www.debian.org",0,null,null,null);
>>>
>>>
>>>> Thanks in advance.
>>>
>>> _______________________________________________
>>> dev-tech-java mailing list
>>> [email protected]
>>> https://lists.mozilla.org/listinfo/dev-tech-java
>>>
>>>
>>