code: public void refreshCurve() {
  //        System.out.println("Curve refreshing");
  		needsRefresh = false;
  
          double lengthx = end.x - start.x;
          double lengthy = end.y - start.y;
          double centerx = ((double) (start.x + end.x)) / 2.0;
          double centery = ((double) (start.y + end.y)) / 2.0;
  
          double length = Math.sqrt(lengthx * lengthx + lengthy * lengthy);
          double factorx = length == 0.0 ? 0.0 : lengthx / length;
          double factory = length == 0.0 ? 0.0 : lengthy / length;
  
          control.x = (int) (centerx + curvy * HEIGHT * factory);
          control.y = (int) (centery - curvy * HEIGHT * factorx);
          high.x = (int) (centerx + curvy * HEIGHT * factory / 2.0);
          high.y = (int) (centery - curvy * HEIGHT * factorx / 2.0);
  
          curve.setCurve((float) start.x, (float) start.y, (float) control.x,
                  (float) control.y, (float) end.x, (float) end.y);
  
          affineToText = new AffineTransform();
          affineToText.translate(high.x, high.y);
          affineToText.rotate(Math.atan2(lengthy, lengthx));
          if (end.x < start.x)
              affineToText.rotate(Math.PI);
  	}
docs: Refreshes the curve object.