g.setColor(Color.black);
g.drawOval(r.x, r.y, r.width, r.height);
}
private int constrainX(int x) {
LineConnection line = ownerConnection();
Figure startFigure = line.getStartConnector().owner();
Figure endFigure = line.getEndConnector().owner();
Rectangle start = startFigure.getDisplayBox();
Rectangle end = endFigure.getDisplayBox();
Insets i1 = startFigure.connectionInsets();
Insets i2 = endFigure.connectionInsets();
int r1x, r1width, r2x, r2width;
r1x = start.x + i1.left;
r1width = start.width - i1.left - i1.right - 1;
r2x = end.x + i2.left;
r2width = end.width - i2.left - i2.right - 1;
if (fSegment == 0) {
x = Geom.range(r1x, r1x + r1width, x);
}
if (fSegment == line.pointCount() - 2) {
x = Geom.range(r2x, r2x + r2width, x);
}
return x;
}