@SuppressWarnings( "unchecked" )
	public static boolean isPermanentFocusOwner( Component c ) {
		KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();

		if( c instanceof JComponent ) {
			Object value = ((JComponent)c).getClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER );
			if( value instanceof Predicate ) {
				return ((Predicate<JComponent>)value).test( (JComponent) c ) &&
					isInActiveWindow( c, keyboardFocusManager.getActiveWindow() );
			}
		}

		// invoke hasFocus() here because components may have overridden this method
		// (e.g. Swing delegate components used for AWT components on macOS)
		if( c.hasFocus() )
			return true;

		return keyboardFocusManager.getPermanentFocusOwner() == c &&
			isInActiveWindow( c, keyboardFocusManager.getActiveWindow() );
	}
Returns whether the given component is the permanent focus owner and
is in the active window or in a popup window owned by the active window.
Used to paint focus indicators.
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java