code: private void transformEdgeShape(Point2D down, Point2D out) {
      float x1 = (float) down.getX();
      float y1 = (float) down.getY();
      float x2 = (float) out.getX();
      float y2 = (float) out.getY();
  
      AffineTransform xform = AffineTransform.getTranslateInstance(x1, y1);
      
      float dx = x2-x1;
      float dy = y2-y1;
      float thetaRadians = (float) Math.atan2(dy, dx);
      xform.rotate(thetaRadians);
      float dist = (float) Math.sqrt(dx*dx + dy*dy);
      xform.scale(dist / rawEdge.getBounds().getWidth(), 1.0);
      edgeShape = xform.createTransformedShape(rawEdge);
  }
docs: code lifted from PluggableRenderer to move an edge shape into an
  arbitrary position