public boolean startDragging(MouseEvent mouseEvent) {

    // Get the mouse position and the component of the mouse event.
    Component mouseComponent = (Component) mouseEvent.getSource();
    int x = mouseEvent.getX();
    int y = mouseEvent.getY();

    // Reset the fields.
    reset();

    // Initialize the fields for docking.

    // Get the origin dock.
    originDock = (LeafDock) SwingUtilities.getAncestorOfClass(LeafDock.class, mouseComponent);
    if (originDock != null) {
      // Control that the dragged dockable belongs to this dock.
      if (originDock.containsDockable(draggedDockable)) {
        // Calculate the dockable offset.
        dockableOffset.setLocation(x, y);
        dockableOffset =
            SwingUtilities.convertPoint(
                mouseComponent, dockableOffset, draggedDockable.getContent());

        // We could find a dockable for dragging.
        return true;
      }
    }

    // We could not find a dockable for dragging.
    return false;
  }
  /** Adds a drag listener on the content component of a dockable. */
  private void createDockableDragger(Dockable dockable) {

    // Create the dragger for the dockable.
    DragListener dragListener =
        DockingManager.getDockableDragListenerFactory().createDragListener(dockable);
    dockable.getContent().addMouseListener(dragListener);
    dockable.getContent().addMouseMotionListener(dragListener);
  }