Need Help regarding leaflet4j java lib

38 views
Skip to first unread message

Mohammad Fariduddin

unread,
Jul 15, 2016, 9:03:47 AM7/15/16
to DukeScript
hi,

i am new in JavaFX.

i need help how use this leaflet4j lib in JavaFX in swing Application.

i using netbeans to create the application.


and the source code i get from github unable to compile in netbeans. 

i hope there anyone can help me by showing step by step to do it. 

i need real map publish in my java application.

thanks.

Jaroslav Tulach

unread,
Jul 16, 2016, 4:36:06 AM7/16/16
to Mohammad Fariduddin, DukeScript
Hello Mohammad,
I think it is great that you are new to JavaFX - with DukeScript, you don't have to learn (much of) JavaFX at all! There is an excellent paper written by Toni describing that: https://dukescript.com/update/2016/01/22/dukescript-for-swing.html

As far as embedding of DukeScript into Swing goes, I've done it for the NetBeans Platform and it is a matter of using JFXPanel and configuring it properly. An example of my code can be found at http://hg.netbeans.org/releases/file/1517f4981839/api.htmlui/src/org/netbeans/modules/htmlui - but most of that is NetBeans specific - your code will be even simpler:

- create JavaFX scene with a WebView component: http://hg.netbeans.org/releases/file/1517f4981839/api.htmlui/src/org/netbeans/modules/htmlui/HtmlComponent.java#l125
- wrap that into a JFXPanel and insert it into Swing hierarchy
- use FXBrowsers to configure WebView for DukeScript: http://bits.netbeans.org/html+java/1.3/net/java/html/boot/fx/FXBrowsers.html
 
That should be it. Good luck!
-jt

PS: Beware of threads! Swing and DukeScript run (by default) in different threads and you need to use http://bits.netbeans.org/html+java/1.3/net/java/html/boot/fx/FXBrowsers.html#runInBrowser(javafx.scene.web.WebView,%20java.lang.Runnable) or http://bits.netbeans.org/html+java/1.3/net/java/html/BrwsrCtx.html#execute(java.lang.Runnable) to switch from Swing thread to DukeScript thread




--
You received this message because you are subscribed to the Google Groups "DukeScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dukescript+...@googlegroups.com.
Visit this group at https://groups.google.com/group/dukescript.
To view this discussion on the web visit https://groups.google.com/d/msgid/dukescript/9ce70238-16dc-401b-a086-b22ee22d0e22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages