private void scanComponent(Component comp, DockEvent event, boolean drop, Point p, Rectangle compBounds) {
		int distTop = p.y - compBounds.y;
		int distLeft = p.x - compBounds.x;
		int min = Math.min(distTop, distLeft);
		int distRight = compBounds.x + compBounds.width - p.x;
		int distBottom = compBounds.y + compBounds.height - p.y;
		int min2 = Math.min(distBottom, distRight);
		min = Math.min(min, min2);
		Dockable dockable = event.getDragSource().getDockable();
		DockableState.Location splitState = DockingUtilities.getDockableLocationFromHierarchy(this);
		DockableState.Location dockableState = dockable.getDockKey().getLocation();

		if(min == distTop) {
			// dock on top
			if(drop) {
				event.setDockingAction(new DockingActionSplitComponentEvent(event.getDesktop(), dockable, dockableState, splitState, comp, DockingConstants.SPLIT_TOP, 0.5f));

				((DockDropEvent) event).acceptDrop();

				event.getDesktop().splitComponent(comp, event.getDragSource().getDockable(), DockingConstants.SPLIT_TOP);
			} else {
				Rectangle2D r2d = new Rectangle2D.Float(compBounds.x, compBounds.y, compBounds.width, 20);
				event.setDockingAction(new DockingActionSplitComponentEvent(event.getDesktop(), dockable, dockableState, splitState, comp, DockingConstants.SPLIT_TOP, 0.5f));

				((DockDragEvent) event).acceptDrag(r2d);
			}
		} else if(min == distLeft) {
			if(drop) {
				event.setDockingAction(new DockingActionSplitComponentEvent(event.getDesktop(), dockable, dockableState, splitState, comp, DockingConstants.SPLIT_LEFT, 0.5f));

				((DockDropEvent) event).acceptDrop();
				event.getDesktop().splitComponent(comp, event.getDragSource().getDockable(), DockingConstants.SPLIT_LEFT);
			} else {
				Rectangle2D r2d = new Rectangle2D.Float(compBounds.x, compBounds.y, 20, compBounds.height);

				event.setDockingAction(new DockingActionSplitComponentEvent(event.getDesktop(), dockable, dockableState, splitState, comp, DockingConstants.SPLIT_LEFT, 0.5f));

				event.setDockingAction(new DockingActionSplitComponentEvent(event.getDesktop(), dockable, dockable.getDockKey().getLocation(), splitState, comp, DockingConstants.SPLIT_TOP, 0.5f));

				((DockDragEvent) event).acceptDrag(r2d);
			}
		} else if(min == distBottom) {
			if(drop) {
				event.setDockingAction(new DockingActionSplitComponentEvent(event.getDesktop(), dockable, dockableState, splitState, comp, DockingConstants.SPLIT_BOTTOM, 0.5f));

				((DockDropEvent) event).acceptDrop();
				event.getDesktop().splitComponent(comp, event.getDragSource().getDockable(), DockingConstants.SPLIT_BOTTOM);
			} else {
				Rectangle2D r2d = new Rectangle2D.Float(compBounds.x, compBounds.y + compBounds.height - 20, compBounds.width, 20);
				event.setDockingAction(new DockingActionSplitComponentEvent(event.getDesktop(), dockable, dockableState, splitState, comp, DockingConstants.SPLIT_BOTTOM, 0.5f));

				((DockDragEvent) event).acceptDrag(r2d);
			}
		} else { // right
			if(drop) {
				event.setDockingAction(new DockingActionSplitComponentEvent(event.getDesktop(), dockable, dockableState, splitState, comp, DockingConstants.SPLIT_RIGHT, 0.5f));

				((DockDropEvent) event).acceptDrop();
				event.getDesktop().splitComponent(comp, event.getDragSource().getDockable(), DockingConstants.SPLIT_RIGHT);
			} else {
				Rectangle2D r2d = new Rectangle2D.Float(compBounds.x + compBounds.width - 20, compBounds.y, 20, compBounds.height);
				event.setDockingAction(new DockingActionSplitComponentEvent(event.getDesktop(), dockable, dockableState, splitState, comp, DockingConstants.SPLIT_RIGHT, 0.5f));

				((DockDragEvent) event).acceptDrag(r2d);
			}
		}
	}