/** * Set the view of the scrollable picture to show the map location * * @param mapLocation "(x, y)" */ public void setView(String mapLocation) { int x = Integer.parseInt(mapLocation.substring(1, mapLocation.indexOf(','))); int y = Integer.parseInt( mapLocation.substring(mapLocation.indexOf(", ") + 2, mapLocation.length() - 1)); Point point = new Point(x - (mapScrollPane.getWidth() / 2), y - (mapScrollPane.getHeight() / 2)); map.showLocation(true, x, y); mapScrollPane.getViewport().setViewPosition(point); }
/** Clear map data by hiding the location indicator */ public void clearMapData() { map.showLocation(false, 0, 0); }