private boolean captionHitTest( Point pt ) {
		// Windows invokes this method every ~200ms, even if the mouse has not moved
		long time = System.currentTimeMillis();
		if( pt.x == lastCaptionHitTestX && pt.y == lastCaptionHitTestY && time < lastCaptionHitTestTime + 300 ) {
			lastCaptionHitTestTime = time;
			return lastCaptionHitTestResult;
		}

		// convert pt from window coordinates to layeredPane coordinates
		Component layeredPane = rootPane.getLayeredPane();
		int x = pt.x;
		int y = pt.y;
		for( Component c = layeredPane; c != window && c != null; c = c.getParent() ) {
			x -= c.getX();
			y -= c.getY();
		}

		lastCaptionHitTestX = pt.x;
		lastCaptionHitTestY = pt.y;
		lastCaptionHitTestTime = time;
		lastCaptionHitTestResult = isTitleBarCaptionAt( layeredPane, x, y );
		return lastCaptionHitTestResult;
	}
Returns whether there is a component at the given location, that processes
mouse events. E.g. buttons, menus, etc.
<p>
Note:
<ul>
  <li>This method is invoked often when mouse is moved over window title bar area
      and should therefore return quickly.
  <li>This method is invoked on 'AWT-Windows' thread (not 'AWT-EventQueue' thread)
      while processing Windows messages.
      It <b>must not</b> change any component property or layout because this could cause a dead lock.
</ul>
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTitlePane.java