Have labels on links always on top

When I have multiple links which are very close to one another the labels on the links end up being covered up by either other links or part of the labels from other links. I was wondering if there was a way to have the labels always appear on top and also have them avoid one another?

Thanks for your time

I suppose you could override JGoLabeledLink.layoutMidLabel to try to be smart.
You could also let users move labels by hand–the Processor example does this.

Would you happen to have an example of the layoutMidLabel being used?

The Processor example demonstrates overriding positionMidLabel, which layoutMidLabel calls after deciding which segment is the “middle” one.

How would I obtain the x and y coordinates of the label once it is attached to the link? I was thinking of using this info to calculate the area of the label and to also somehow aid in positioning other labels so as not to collide into one another. I tried using the getLocation() but it seems to return at times one coordinates where other times it returns multiple. A little confused

Any JGoObject’s position is available with getLeft() and getTop(), or more generally, with getBoundingRect().
getLocation() for JGoText objects will return different spots depending on the alignment. However, getTopLeft() will always return the top-left corner’s coordinates.