如何在地图面板上设置位置点? [英] how to set location point on map panel?
本文介绍了如何在地图面板上设置位置点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码在java swing应用程序中显示地图
i used this following code for to show the map in java swing application
public class Tracking extends JInternalFrame {
private MapPanel map;
private JLabel map1;
public Tracking(String lan,String lat,String codeno){
super("Tracking :"+codeno+"-Location",false,true,false,true);
setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
setSize(700,500);
map=new MapPanel();
map.setZoom(13);
double lon = Double.valueOf(lan);
double latt = Double.valueOf(lat);
map1=new JLabel(new ImageIcon(ClassLoader.getSystemResource("Image/position.png")));
Point position = map.computePosition(new Point2D.Double(lon,latt));
map1.setLocation(position);
map1.setFocusable(true);
map.setIgnoreRepaint(true);
map.setFocusable(true);
map.setCenterPosition(position); // sets to the computed position
add(map);
map.add(map1);
}
}
运行良好。但我希望在地图上显示正确的位置。
it runs good. but i want show the correct location on map.
推荐答案
这篇关于如何在地图面板上设置位置点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文