I have a JavaFX application that shows the location point on Google maps. It is working fine when I pass only variables in javascript. Hhere is the code in JavaFX where I am passing the variables name (lat and lon)
public void handle(ActionEvent arg0) {
lat = Double.parseDouble(latitude.getText());
lon = Double.parseDouble(longitude.getText());
System.out.printf("%.2f %.2f%n", lat, lon);
webEngine.executeScript("" +
"window.lat = " + lat + ";" +
"window.lon = " + lon + ";" +
"document.goToLocation(window.lat, window.lon);"
);
}
});
I want to pass a double array instead of double variable. Here is the javascript function where I am receiving values from Java variable name (x and y)
document.goToLocations = function(x, y) {
alert("goToLocation, x: " + x +", y:" + y);
var latLng = new google.maps.LatLng(x, y);
marker.setPosition(latLng);
map.setCenter(latLng);
}
And here is the code example link that i am using Code Example
eval()method and assign it to a variable there.