Program: 85459
Project: 85459
Buggy source:
@Override public void mousePressed(MouseEvent event){
  if (minimized) {
    maximize();
    return;
  }
  if (event.getX() > sourceX + ITEM_WIDTH && event.getX() < sourceX + ITEM_WIDTH + ARROW_START_WIDTH) {
    for (    LabeledRectangle item : getVisibleSourceComponents()) {
      if (event.getY() >= item.getY() && event.getY() <= item.getY() + item.getHeight()) {
        dragArrow=new Arrow(item);
        dragArrow.setTargetPoint(new Point(item.getX() + item.getWidth() + Arrow.headThickness,item.getY() + item.getHeight() / 2));
        showingArrowStarts=false;
        repaint();
        break;
      }
    }
  }
 else   if (event.getX() > targetX - ARROW_START_WIDTH && event.getX() < targetX && dragArrow == null) {
    for (    Arrow arrow : arrows) {
      if (event.getY() >= arrow.getTarget().getY() && event.getY() <= arrow.getTarget().getY() + arrow.getTarget().getHeight() && arrow.isSourceAndTargetVisible()) {
        dragArrow=arrow;
        dragArrowPreviousTarget=dragArrow.getTarget();
        dragArrow.setTarget(null);
        break;
      }
    }
    if (dragArrow != null) {
      arrows.remove(dragArrow);
    }
    repaint();
  }
 else {
    for (    LabeledRectangle item : getVisibleSourceComponents()) {
      if (item.contains(event.getPoint())) {
        dragRectangle=item;
        dragOffsetY=event.getY() - item.getY();
        break;
      }
    }
    for (    LabeledRectangle item : getVisibleTargetComponents()) {
      if (item.contains(event.getPoint())) {
        dragRectangle=item;
        dragOffsetY=event.getY() - item.getY();
        break;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void mousePressed(MouseEvent event){
  if (minimized) {
    maximize();
    return;
  }
  if (event.getX() > sourceX + ITEM_WIDTH && event.getX() < sourceX + ITEM_WIDTH + ARROW_START_WIDTH) {
    for (    LabeledRectangle item : getVisibleSourceComponents()) {
      if (event.getY() >= item.getY() && event.getY() <= item.getY() + item.getHeight()) {
        dragArrow=new Arrow(item);
        dragArrow.setTargetPoint(new Point(item.getX() + item.getWidth() + Arrow.headThickness,item.getY() + item.getHeight() / 2));
        showingArrowStarts=false;
        repaint();
        break;
      }
    }
  }
 else   if (event.getX() > cdmX - ARROW_START_WIDTH && event.getX() < cdmX && dragArrow == null) {
    for (    Arrow arrow : arrows) {
      if (event.getY() >= arrow.getTarget().getY() && event.getY() <= arrow.getTarget().getY() + arrow.getTarget().getHeight() && arrow.isSourceAndTargetVisible()) {
        dragArrow=arrow;
        dragArrowPreviousTarget=dragArrow.getTarget();
        dragArrow.setTarget(null);
        break;
      }
    }
    if (dragArrow != null) {
      arrows.remove(dragArrow);
    }
    repaint();
  }
 else {
    for (    LabeledRectangle item : getVisibleSourceComponents()) {
      if (item.contains(event.getPoint())) {
        dragRectangle=item;
        dragOffsetY=event.getY() - item.getY();
        break;
      }
    }
    for (    LabeledRectangle item : getVisibleTargetComponents()) {
      if (item.contains(event.getPoint())) {
        dragRectangle=item;
        dragOffsetY=event.getY() - item.getY();
        break;
      }
    }
  }
}