小编Kie*_*anS的帖子

如何在JMapViewer中将工具提示添加到MapMarker

我想要一个添加ToolTip到自定义MapMarkerJMapViewer。但是,取消搜索并不能帮助我解决这个问题。

自定义MapMarker为:

public class MapMarkerUnit extends MapObjectImpl implements MapMarker
Run Code Online (Sandbox Code Playgroud)

绘制方法的覆盖是

public void paint(Graphics g, Point position, int radio) {
    String filename = "marker.png";
    //System.out.print(filename);
    BufferedImage x = null;
    try {
        x = ImageIO.read(getClass().getResource(filename));
    } catch (IOException ex) {
        Logger.getLogger(MapMarkerUnit.class.getName()).log(Level.SEVERE, null, ex);
    }

    g.drawImage(x, position.x-16, position.y-37,null);

    //if(getLayer()==null||getLayer().isVisibleTexts()) paintText(g, new       Point(position.x+20,position.y));
}
Run Code Online (Sandbox Code Playgroud)

感谢您提供的任何帮助。

java jmapviewer

2
推荐指数
1
解决办法
1159
查看次数

标签 统计

java ×1

jmapviewer ×1