Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JavaFX with Google Maps and JavaScript Callback

1052509Apr 5 2014 — edited Apr 5 2014

Hello everyone,

I wanted to create an application in javafx where the use can click on the google map and the application will save the x-y coordinates. I found this

article on java fx experience Maps in JavaFX 2.0 // JavaFX News, Demos and Insight // FX Experience and that worked very well. But this example

only communicates from javafx to javascript.

Now I added this method to their java script:

google.maps.event.addListener(document.map, "click", function(event) {

    var lat = event.latLng.lat();

    var lng = event.latLng.lng();

    // populate yor box/field with lat, lng

    alert("Lat=" + lat + "; Lng=" + lng);

});

and it works if I call the html page by itself. But if I click on the map inside my javafx application, no popup will be shown. That probably something with the webengine,

but I don't need the popup, I need the information lat and lng in my java fx application.

Does anyone has an idea of how to realize that?

Thanks,

Hauke

This post has been answered by James_D on Apr 5 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 3 2014
Added on Apr 5 2014
1 comment
1,453 views