public void mouseReleased(MouseEvent e) {
    synchronized (futureData) {
      // This might be the end of a drag
      if (isDragging) {
        // In case we already have a dragEnded and we get another
        // dragEnded, should use the new one
        if (futureData.isMouseDragEnded(null)) {
          futureData = potentialNewDragData;
        }

        if (!PriorityManager.isHigherPriority(e, futureData)) return;
        registerEventRecieved();
        int x = locator.getTranslatedX(e);
        int y = locator.getTranslatedY(e);
        int button = getButton(e);

        Actor clickActor = locator.getTopMostActorAt(e);
        futureData.mouseClicked(x, y, button, 1, clickActor);

        Actor actor = dragStartData.getActor();
        futureData.mouseDragEnded(x, y, button, actor);
        isDragging = false;
        potentialNewDragData = new MouseEventData();
      }
    }
  }
 public void mouseMoved(MouseEvent e) {
   synchronized (futureData) {
     if (!PriorityManager.isHigherPriority(e, futureData)) return;
     registerEventRecieved();
     Actor actor = locator.getTopMostActorAt(e);
     int x = locator.getTranslatedX(e);
     int y = locator.getTranslatedY(e);
     int button = getButton(e);
     futureData.mouseMoved(x, y, button, actor);
     isDragging = false;
   }
 }
  public void mouseDragged(MouseEvent e) {
    synchronized (futureData) {
      isDragging = true;

      if (!PriorityManager.isHigherPriority(e, futureData)) return;
      registerEventRecieved();

      // Find and store the actor that relates to this drag.
      int x = locator.getTranslatedX(e);
      int y = locator.getTranslatedY(e);
      int button = getButton(e);
      futureData.mouseDragged(x, y, button, dragStartData.getActor());
    }
  }
  public void mouseClicked(MouseEvent e) {
    synchronized (futureData) {
      MouseEventData mouseData = futureData;
      // In case we already have a dragEnded and we get another
      // dragEnded, we need to start collection data for that.
      if (futureData.isMouseDragEnded(null)) {
        mouseData = potentialNewDragData;
      }
      if (!PriorityManager.isHigherPriority(e, mouseData)) return;
      registerEventRecieved();
      Actor actor = locator.getTopMostActorAt(e);
      int x = locator.getTranslatedX(e);
      int y = locator.getTranslatedY(e);
      int button = getButton(e);

      mouseData.mouseClicked(x, y, button, e.getClickCount(), actor);
      isDragging = false;
    }
  }
  public void mousePressed(MouseEvent e) {
    synchronized (futureData) {
      MouseEventData mouseData = futureData;
      // In case we already have a dragEnded and we get another
      // dragEnded, we need to start collection data for that.
      if (futureData.isMouseDragEnded(null)) {
        mouseData = potentialNewDragData;
      }

      // This might be the beginning of a drag so we store it
      dragStartData = new MouseEventData();
      Actor actor = locator.getTopMostActorAt(e);
      int x = locator.getTranslatedX(e);
      int y = locator.getTranslatedY(e);
      int button = getButton(e);
      dragStartData.mousePressed(x, y, button, actor);

      // We only really want to register this event as a press if there is no higher priorities
      if (!PriorityManager.isHigherPriority(e, mouseData)) return;
      registerEventRecieved();
      mouseData.mousePressed(x, y, button, actor);
      isDragging = false;
    }
  }