如何使用JUNG的注释系统注释我的图形?

时间:2012-11-27 18:45:15

标签: java swing jung

我似乎找不到任何关于注释我的JUNG图的文档。我拼凑的最多的是:

AnnotationRenderer renderer = new AnnotationRenderer();
AnnotationPaintable annotate = new AnnotationPaintable(viewer.getRenderContext(), renderer);

Shape square = new Rectangle(0, 0, 50, 50);
Annotation<Shape> a = new Annotation<Shape>(square, Annotation.Layer.UPPER, null, true,
                new Point2D.Double(0, 0));
annotate.add(a);

如何进行此操作并开始在AnnotationPaintable对象中绘制实际注释?

1 个答案:

答案 0 :(得分:1)

答案是将其添加到您的可视化查看器中:

viewer.addPostRenderPaintable(...)