我收到错误...
java.lang.RuntimeException: Deferred binding failed for 'com.google.gwt.maps.client.impl.MapImpl' (did you forget to inherit a
required module?).......Caused by: java.lang.IncompatibleClassChangeError: Found interface
com.google.gwt.core.ext.typeinfo.JClassType, but class was expected.....
我已将 gwt-maps.jar 包含在 Java 构建路径中,并将以下内容添加到我的 .gwt.xml 文件中:
inherits name="com.google.gwt.maps.GoogleMaps" and <br>
script src="http://maps.google.com/maps?gwt=1&file=api&v=2&sensor=false"
我的源代码如下。
package com.mymaps.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.maps.client.InfoWindow;
import com.google.gwt.maps.client.InfoWindowContent;
import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.control.LargeMapControl;
import com.google.gwt.maps.client.geom.LatLng;
import com.google.gwt.maps.client.overlay.Marker;
//import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.RootPanel;
public class GWTMaps implements EntryPoint
{
private MapWidget mapdd;
public void onModuleLoad()
{
LatLng somewhereInTexas = LatLng.newInstance(30.000, -97.000);
mapdd = new MapWidget(somewhereInTexas, 2);
//map = new MapWidget();
mapdd.setSize("500px", "500px");
mapdd.addControl(new LargeMapControl());
//final Marker marker = new Marker(somewhereInTexas);
//mapdd.addOverlay(marker);
final InfoWindow infoWin = mapdd.getInfoWindow();
infoWin.open(mapdd.getCenter(), new InfoWindowContent("Deep in Texas..."));
/*Timer t = new Timer()
{
public void run()
{
LatLng newAddress = LatLng.newInstance(18.000, 10.000);
infoWin.close();
marker.setVisible(false);
marker.setLatLng(newAddress);
marker.setVisible(true);
map.getInfoWindow().open(newAddress, new InfoWindowContent("Somewhere in Africa..."));
map.panTo(newAddress);
}
};
t.schedule(6000);*/
RootPanel.get("mapsTutorial").add(mapdd);
}
}