// Create the target that finds sites on the figures
target = new SelfPTarget();
// Create the first connector. We don't care about the actual
// location at this stage
Site a = target.getTailSite(figureA, 0.0, 0.0);
Site b = target.getHeadSite(figureB, 0.0, 0.0);
connectorA = new StraightConnector(a, b);
layer.add(connectorA);
// Add an arrowhead to it
Arrowhead arrow = new Arrowhead(b.getX(), b.getY(), b.getNormal());
connectorA.setHeadEnd(arrow);
// Create the second connector with an arrowhead
a = target.getTailSite(figureB, 0.0, 0.0);
b = target.getHeadSite(figureC, 0.0, 0.0);
connectorB = new ArcConnector(a, b);
layer.add(connectorB);
arrow = new Arrowhead(b.getX(), b.getY(), b.getNormal());
connectorB.setHeadEnd(arrow);
// Create the third connector with an arrowhead
a = target.getTailSite(figureB, 0.0, 0.0);
b = target.getHeadSite(figureC, 0.0, 0.0);
connectorC = new ArcConnector(a, b);
// Swap the direction
connectorC.setAngle(-connectorC.getAngle());
layer.add(connectorC);
arrow = new Arrowhead(b.getX(), b.getY(), b.getNormal());
connectorC.setHeadEnd(arrow);
// Create a fourth connector with an arrowhead, which is a "self-loop"
a = target.getTailSite(figureB, 0.0, 0.0);
b = target.getHeadSite(figureB, 0.0, 0.0);
connectorD = new ArcConnector(a, b);
connectorD.setSelfLoop(true);
// Swap the direction
// connectorD.setAngle(-connectorD.getAngle());
// connectorD.setAngle(-0.1);
layer.add(connectorD);
arrow = new Arrowhead(b.getX(), b.getY(), b.getNormal());
connectorD.setHeadEnd(arrow);
}