Pergunta

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

Foi útil?

Solução

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);

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top