Source: https://stackoverflow.com/questions/23543415/how-to-add-google-map-for-gwt-into-formpanel
How to add Google map for GWT into FormPanel?
Here is the code.
Simply call below line and the map is added in formPanel.
GoogleMap gMap = GoogleMap.create(formPanel.getElement(), options);Some more configuration as defined below:
gwt.xml:
<inherits name="com.google.maps.gwt.GoogleMaps" />
<script src="http://maps.google.com/maps/api/js?sensor=false" />gwt-maps.jar in build path of the project.
Sample code:
public void onModuleLoad() {
FormPanel formPanel = new FormPanel();
formPanel.setWidth("500px");
formPanel.setHeight("650px");
RootPanel.get().add(formPanel);
MapOptions options = MapOptions.create();
options.setZoom(6);
options.setMapTypeId(MapTypeId.ROADMAP);
options.setDraggable(true);
options.setMapTypeControl(true);
options.setScaleControl(true);
options.setScrollwheel(true);
GoogleMap gMap = GoogleMap.create(formPanel.getElement(), options);
gMap.setCenter(LatLng.create(58.378679, -2.197266));
}