Re: Embedding Mozilla with JavaXPCOM and AWT/Swing
Julien1311 <[email protected]> Wed, 18 Jul 2007 08:40:09 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.java |
|---|---|
| Message-ID | <11670638.post__12200.9245715619$1184773240$gmane$org@talk.nabble.com> |
Thanks for your help but, actually, I have a Swing application and I want to try to embed a SWT browser into it. So, the problem is not embedding Swing/awt in swt but swt in Swing/awt. I don't manage to find a documentation on that point. Grant Gayed wrote: > > Embedding swing/awt in swt is well supported on all platforms. Links: > > http://www.eclipse.org/swt/faq.php#swinginswt > http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet135.java?view=co > http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet154.java?view=co > http://www.eclipse.org/articles/article.php?file=Article-Swing-SWT-Integration/index.html > > Grant > > > "Greg Bowyer" <[email protected]> wrote in message > news:[email protected]... >> Sorry had to spend a bit of time thinking about this, I am actually not >> a GUI programmer by trade :S >> >> Going back to hooky ways to pull this off, it might be possible to embed >> swing / awt inside SWT (I know this is a bit of a reverse of >> "Am I right or is there a way to add a SWT component to a Swing app?" ) >> >> I am unsure about how well supported it is across platforms, and if it >> has issues with any advanced usages of swing, but otherwise it might be >> worth a look >> >> > http://wiki.eclipse.org/index.php/FAQ_How_do_I_embed_AWT_and_Swing_inside_SWT%3F >> and >> > http://www.eclipse.org/articles/Article-Swing-SWT-Integration/files/example-javadoc/swingintegration/example/EmbeddedSwingComposite.html >> >> Julien1311 wrote: >> > I already saw that I could use SWT. The problem is that I have to embed > my >> > browser in a already-done Swing application. I was planning to embed >> the >> > browser in a JPanel and to add the JPanel to the Swing app. I think >> it's >> > impossible to do such a thing with SWT. I've read that it's impossible > to >> > add SWT components to a Swing app, that's why I was looking for a way >> to > do >> > it with Swing/AWT. >> > >> > Am I right or is there a way to add a SWT component to a Swing app? >> > >> > Thanks for your help >> > >> > >> > >> > Greg Bowyer wrote: >> >> 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 >> >>>>> >> >>>>> >> >> _______________________________________________ >> >> dev-tech-java mailing list >> >> [email protected] >> >> https://lists.mozilla.org/listinfo/dev-tech-java >> >> >> >> >> > >> > > > _______________________________________________ > dev-tech-java mailing list > [email protected] > https://lists.mozilla.org/listinfo/dev-tech-java > > -- View this message in context: http://www.nabble.com/Embedding-Mozilla-with-JavaXPCOM-and-AWT-Swing-tf4084873.html#a11670638 Sent from the Mozilla - OJI mailing list archive at Nabble.com.