문제

I'm trying to display a network-topology. Everything works fine, except I can't figure out how to display two or three labels per edge, one at either end of the edge and (optionally) one in the middle. I've tried a few things, but I haven't found anything that does not involve ugly hacks...

Here's what it should look like (with the labels GIMP-ed in)

Is this even possible?

Thanks

rakudave

도움이 되었습니까?

해결책

Look at the JUNG2 API docs in the package edu.uci.ics.jung.visualization.renderers. Most work gets done by the DefaultEdgeLabelRenderer defined in this package, but you'll have to create your own custom edge label renderer.

The documentation isn't very comprehensive, so you'll need to go through the sources and find the DefaultEdgeLabelRenderer class, and create your own class based on this one that does what you want. You can then set this class as your EdgeLabelRenderer by a call to:

vv.getRenderContext().setEdgeLabelRenderer(yourEdgeLabelRendererHere);

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top