问题
When using JMapViewer, is there any way to automatically display lat/lon grid lines? The JMapViewer.setTileGridVisible
method is unfortunately not the same thing. I know it's possible to do it manually, but then I have to figure out when to display what resolutions, etc. Sounds like a pain.
回答1:
As an alternative, you can override mouseMoved()
in DefaultMapController
using the approach shown here. In the handler, you can update a label or set a tooltip, for example:
new DefaultMapController(map) {
@Override
public void mouseMoved(MouseEvent e) {
map.setToolTipText(map.getPosition(e.getPoint()).toString());
}
};
来源:https://stackoverflow.com/questions/17030973/how-to-add-lat-lon-grid-lines-to-jmapviewer