@Override
	public Popup getPopup( Component owner, Component contents, int x, int y )
		throws IllegalArgumentException
	{
		Point pt = fixToolTipLocation( owner, contents, x, y );
		if( pt != null ) {
			x = pt.x;
			y = pt.y;
		}

		fixLinuxWaylandJava21focusIssue( owner );

		// reuse a heavy weight popup window, which is still shown on screen,
		// to avoid flicker when popup (e.g. tooltip) is moving while mouse is moved
		for( NonFlashingPopup popup : stillShownHeavyWeightPopups ) {
			if( popup.delegate != null &&
				popup.owner == owner &&
				(popup.contents == contents ||
				 (popup.contents instanceof JToolTip && contents instanceof JToolTip)) )
			{
				stillShownHeavyWeightPopups.remove( popup );
				return reuseStillShownHeavyWeightPopups( popup, contents, x, y );
			}
		}

		boolean forceHeavyWeight = isOptionEnabled( owner, contents, FlatClientProperties.POPUP_FORCE_HEAVY_WEIGHT, "Popup.forceHeavyWeight" );

		if( !isOptionEnabled( owner, contents, FlatClientProperties.POPUP_DROP_SHADOW_PAINTED, "Popup.dropShadowPainted" ) || SystemInfo.isProjector || SystemInfo.isWebswing )
			return new NonFlashingPopup( getPopupForScreenOfOwner( owner, contents, x, y, forceHeavyWeight ), owner, contents );

		// macOS and Linux adds drop shadow to heavy weight popups
		if( SystemInfo.isMacOS || SystemInfo.isLinux ) {
			NonFlashingPopup popup = new NonFlashingPopup( getPopupForScreenOfOwner( owner, contents, x, y, true ), owner, contents );
			if( popup.popupWindow != null && isMacOSBorderSupported() )
				setupRoundedBorder( popup.popupWindow, owner, contents );
			return popup;
		}

		// Windows 11 with FlatLaf native library can use rounded corners and shows drop shadow for heavy weight popups
		if( isWindows11BorderSupported() &&
			getBorderCornerRadius( owner, contents ) > 0 )
		{
			NonFlashingPopup popup = new NonFlashingPopup( getPopupForScreenOfOwner( owner, contents, x, y, true ), owner, contents );
			if( popup.popupWindow != null )
				setupRoundedBorder( popup.popupWindow, owner, contents );
			return popup;
		}

		// check whether popup overlaps a heavy weight component
		if( !forceHeavyWeight && overlapsHeavyWeightComponent( owner, contents, x, y ) )
			forceHeavyWeight = true;

		// create drop shadow popup
		Popup popupForScreenOfOwner = getPopupForScreenOfOwner( owner, contents, x, y, forceHeavyWeight );
		GraphicsConfiguration gc = (owner != null) ? owner.getGraphicsConfiguration() : null;
		return (gc != null && gc.isTranslucencyCapable())
			? new DropShadowPopup( popupForScreenOfOwner, owner, contents )
			: new NonFlashingPopup( popupForScreenOfOwner, owner, contents );
	}
A popup factory that adds drop shadows to popups on Windows.
On macOS and Linux, heavy weight popups (without drop shadow) are produced and the
operating system automatically adds drop shadows.

@author Karl Tauber
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatPopupFactory.java