在JUNG图中选择/移动/调整大小/删除注释

时间:2013-02-05 06:51:09

标签: java jung

JUNG是否能够从图表中挑选,移动,调整大小或删除Annotation个对象?

修改

在考虑AnnotationDemo(由@sdasdadas引用)之后,确定了下列感兴趣的代码(第126-134行):

// Get the RenderContext for this visualization viewer
RenderContext<String,Number> rc = vv.getRenderContext();

// Create a new AnnotatingGraphMousePlugin with default settings.
// The AnnotatingGraphMousePlugin class is a subclass of AbstractGraphMousePlugin
// and also implements the interfaces MouseListener and MouseMotionListener. As
// such, the respective overridden methods would be a interesting place to embed
// the logic for the required behavior. However I am still not sure!
AnnotatingGraphMousePlugin<String,Number> annotatingPlugin =
        new AnnotatingGraphMousePlugin<String,Number>(rc);

// Create a GraphMouse for the main view, using the annotating mouse plugin.
final AnnotatingModalGraphMouse<String,Number> graphMouse = 
        new AnnotatingModalGraphMouse<String,Number>(rc, annotatingPlugin);

和(在第174-180行):

// Create annotation controls to allow the selection of color, shape, fill,
// and z-order. None of these controls is of interest to us.
AnnotationControls<String,Number> annotationControls = 
        new AnnotationControls<String,Number>(annotatingPlugin);

根据上面显示的评论,我的初步问题保持不变。


1 个答案:

答案 0 :(得分:1)

是的,请查看AnnotationsDemo