Program: 77911
Project: 77911
Buggy source:
private Rectangle createDraggableRectangle(double x,double y,double width,double height){
  final double handleRadius=10;
  Rectangle rect=new Rectangle(x,y,width,height);
  rect.setVisible(true);
  rect.setFill(Color.BLACK);
  rect.setOpacity(0.1);
  resizeHandleNW=new Circle(handleRadius,Color.BLACK);
  resizeHandleNW.centerXProperty().bind(rect.xProperty());
  resizeHandleNW.centerYProperty().bind(rect.yProperty());
  resizeHandleSE=new Circle(handleRadius,Color.BLACK);
  resizeHandleSE.centerXProperty().bind(rect.xProperty().add(rect.widthProperty()));
  resizeHandleSE.centerYProperty().bind(rect.yProperty().add(rect.heightProperty()));
  rect.parentProperty().addListener((obs,oldParent,newParent) -> {
    for (    Circle c : Arrays.asList(resizeHandleNW,resizeHandleSE)) {
      Pane currentParent=(Pane)c.getParent();
      if (currentParent != null) {
        currentParent.getChildren().remove(c);
      }
      ((Pane)newParent).getChildren().add(c);
    }
  }
);
  Wrapper<Point2D> mouseLocation=new Wrapper<>();
  setUpDragging(resizeHandleNW,mouseLocation);
  setUpDragging(resizeHandleSE,mouseLocation);
  resizeHandleNW.setOnMouseDragged(event -> {
    if (mouseLocation.value != null) {
      double deltaX=event.getSceneX() - mouseLocation.value.getX();
      double deltaY=event.getSceneY() - mouseLocation.value.getY();
      double newX=rect.getX() + deltaX;
      if (newX >= handleRadius && newX <= rect.getX() + rect.getWidth() - handleRadius) {
        rect.setX(newX);
        rect.setWidth(rect.getWidth() - deltaX);
      }
      double newY=rect.getY() + deltaY;
      if (newY >= handleRadius && newY <= rect.getY() + rect.getHeight() - handleRadius) {
        rect.setY(newY);
        rect.setHeight(rect.getHeight() - deltaY);
      }
      mouseLocation.value=new Point2D(event.getSceneX(),event.getSceneY());
    }
  }
);
  resizeHandleSE.setOnMouseDragged(event -> {
    if (mouseLocation.value != null) {
      double deltaX=event.getSceneX() - mouseLocation.value.getX();
      double deltaY=event.getSceneY() - mouseLocation.value.getY();
      double newMaxX=rect.getX() + rect.getWidth() + deltaX;
      if (newMaxX >= rect.getX() && newMaxX <= rect.getParent().getBoundsInLocal().getWidth() - handleRadius) {
        rect.setWidth(rect.getWidth() + deltaX);
      }
      double newMaxY=rect.getY() + rect.getHeight() + deltaY;
      if (newMaxY >= rect.getY() && newMaxY <= rect.getParent().getBoundsInLocal().getHeight() - handleRadius) {
        rect.setHeight(rect.getHeight() + deltaY);
      }
      mouseLocation.value=new Point2D(event.getSceneX(),event.getSceneY());
    }
  }
);
  rect.setOnMouseDragged(event -> {
    if (mouseLocation.value != null) {
      double deltaX=event.getSceneX() - mouseLocation.value.getX();
      double deltaY=event.getSceneY() - mouseLocation.value.getY();
      double newX=rect.getX() + deltaX;
      double newMaxX=newX + rect.getWidth();
      if (newX >= handleRadius && newMaxX <= rect.getParent().getBoundsInLocal().getWidth() - handleRadius) {
        rect.setX(newX);
      }
      double newY=rect.getY() + deltaY;
      double newMaxY=newY + rect.getHeight();
      if (newY >= handleRadius && newMaxY <= rect.getParent().getBoundsInLocal().getHeight() - handleRadius) {
        rect.setY(newY);
      }
      mouseLocation.value=new Point2D(event.getSceneX(),event.getSceneY());
    }
  }
);
  return rect;
}

Fixed version (ground truth):
private Rectangle createDraggableRectangle(double x,double y,double width,double height){
  final double handleRadius=10;
  Rectangle rect=new Rectangle(x,y,width,height);
  rect.setOpacity(0.1);
  Circle resizeHandleNW=new Circle(handleRadius,Color.BLACK);
  resizeHandleNW.centerXProperty().bind(rect.xProperty());
  resizeHandleNW.centerYProperty().bind(rect.yProperty());
  Circle resizeHandleSE=new Circle(handleRadius,Color.BLACK);
  resizeHandleSE.centerXProperty().bind(rect.xProperty().add(rect.widthProperty()));
  resizeHandleSE.centerYProperty().bind(rect.yProperty().add(rect.heightProperty()));
  rect.parentProperty().addListener((obs,oldParent,newParent) -> {
    for (    Circle c : Arrays.asList(resizeHandleNW,resizeHandleSE)) {
      Pane currentParent=(Pane)c.getParent();
      if (currentParent != null) {
        currentParent.getChildren().remove(c);
      }
      ((Pane)newParent).getChildren().add(c);
    }
  }
);
  Wrapper<Point2D> mouseLocation=new Wrapper<>();
  setUpDragging(resizeHandleNW,mouseLocation);
  setUpDragging(resizeHandleSE,mouseLocation);
  resizeHandleNW.setOnMouseDragged(event -> {
    if (mouseLocation.value != null) {
      double deltaX=event.getSceneX() - mouseLocation.value.getX();
      double deltaY=event.getSceneY() - mouseLocation.value.getY();
      double newX=rect.getX() + deltaX;
      if (newX >= handleRadius && newX <= rect.getX() + rect.getWidth() - handleRadius) {
        rect.setX(newX);
        rect.setWidth(rect.getWidth() - deltaX);
      }
      double newY=rect.getY() + deltaY;
      if (newY >= handleRadius && newY <= rect.getY() + rect.getHeight() - handleRadius) {
        rect.setY(newY);
        rect.setHeight(rect.getHeight() - deltaY);
      }
      mouseLocation.value=new Point2D(event.getSceneX(),event.getSceneY());
    }
  }
);
  resizeHandleSE.setOnMouseDragged(event -> {
    if (mouseLocation.value != null) {
      double deltaX=event.getSceneX() - mouseLocation.value.getX();
      double deltaY=event.getSceneY() - mouseLocation.value.getY();
      double newMaxX=rect.getX() + rect.getWidth() + deltaX;
      if (newMaxX >= rect.getX() && newMaxX <= rect.getParent().getBoundsInLocal().getWidth() - handleRadius) {
        rect.setWidth(rect.getWidth() + deltaX);
      }
      double newMaxY=rect.getY() + rect.getHeight() + deltaY;
      if (newMaxY >= rect.getY() && newMaxY <= rect.getParent().getBoundsInLocal().getHeight() - handleRadius) {
        rect.setHeight(rect.getHeight() + deltaY);
      }
      mouseLocation.value=new Point2D(event.getSceneX(),event.getSceneY());
    }
  }
);
  return rect;
}