private DockingWindow getDeepestWindowAt(Component component, int x, int y) {
    if (component == null || !component.isVisible() || !component.contains(x, y))
      return null;

    if (component instanceof Container) {
      Component[] components = ((Container) component).getComponents();

      for (int i = 0; i < components.length; i++) {
        DockingWindow w = getDeepestWindowAt(components[i], x - components[i].getX(), y - components[i].getY());

        if (w != null)
          return w;
      }
    }

    if (component instanceof DockingWindow) {
      DockingWindow w = (DockingWindow) component;
      return w.getRootWindow() == rootWindow ? w : null;
    }
    else
      return null;
  }