2016-04-13 11 views
0

Webview is not displaying correctlyWebViewが<strong>Google Chromeの</strong>で、右側にロードされ<strong>htmlページ</strong>が<strong>のJavaFXのWebView</strong>にロードされた<strong>htmlページ</strong>であるが、問題があることである正しく

左側に表示されませんGoogleマップのナビゲーションパネルは、JavaFx WebViewには表示されません。私はJava 7u79を使っています。

GoogleMap.java

webView = new WebView(); 
webEngine = webView.getEngine(); 
webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>(){ 
    @Override 
    public void changed(ObservableValue<? extends State> ov, State t, State t1) { 
     System.out.println("STATE : " + t1); 
     if(t1.equals(State.SUCCEEDED)){ 
      root.getChildren().remove(indicator); 
     } 
    } 
}); 

indicator = new ProgressIndicator(); 
indicator.setMaxSize(40, 40); 

String htmlcode = getFileContent("GoogleMap.html"); 
webEngine.loadContent(htmlcode); 

root = new StackPane(); 
root.setAlignment(Pos.CENTER); 
root.getChildren().add(webView); 
root.getChildren().add(indicator); 


Scene scene = new Scene(root, 550, 400); 

primaryStage.setTitle("Google Map"); 
primaryStage.setScene(scene); 
primaryStage.show(); 

GoogleMap.html

<!DOCTYPE html> 
<html> 
<head> 
<script src="http://maps.googleapis.com/maps/api/js"></script> 
<script> 
function initialize() { 
    var mapProp = { 
    center : new google.maps.LatLng(51.508742,-0.120850), 
    zoom : 5, 
    mapTypeId : google.maps.MapTypeId.ROADMAP 
    }; 
    var map=new google.maps.Map(document.getElementById("googleMap"),mapProp); 
} 
google.maps.event.addDomListener(window, 'load', initialize); 
</script> 
<style> 
    body 
    { 
     padding : 0; 
     margin : 0; 
    } 
    #googleMap 
    { 
     width : 550px; 
     height : 400px; 
    } 
</style> 
</head> 

<body> 
<div id="googleMap"></div> 
</body> 

</html> 

答えて

0

私はすべてのそれでOKです。 enter image description here

Java 1.8.0_73多分Javaを更新したり、新しいJavaFXを入手したりするべきですか?

関連する問題