Shows how to keep labels on opposite sides of an edge.
To keep labels on opposite sides of an edge you need to assign different "positions" to them.
For example, the following position assignment will place EdgeLabel l1 above or left to the edge and EdgeLabel l2 below or right to the edge.
l1.setModel(EdgeLabel.SIX_POS);
l1.setPosition(EdgeLabel.HEAD);
l2.setModel(EdgeLabel.SIX_POS);
l2.setPosition(EdgeLabel.TAIL);
|
On the other hand, the
preferredPlacement
attribute of a label serves as a hint for automatic labeling algorithms, only.