Jung2: How to implement displaying details of a node on mouse over of a Node?

半城伤御伤魂 提交于 2019-12-11 08:38:49

问题


I am looking for a way how to display details of a node (as a popup) on MouseOver. Unfortunately the Jung2 tutorial does not provide any information how to implement this kind of functionality. Could anybody share a code sample or point me to an example on the web?


回答1:


PluggableRendererDemo does this.




回答2:


use VisualizationViewer.setVertexToolTipTransformer

From the EdgeLabelDemo you can see a simple example is to use the built-in transformer:

vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>());

You can also do with edges:

vv.setEdgeToolTipTransformer(new Transformer<Number,String>(){
    public String transform(Number e) {
        return "Edge:"+graph.getEndpoints(e).toString();
    }
});


来源:https://stackoverflow.com/questions/7075713/jung2-how-to-implement-displaying-details-of-a-node-on-mouse-over-of-a-node

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!