static Object install( JRootPane rootPane ) {
		if( !isSupported() )
			return null;

		// do nothing if root pane has a parent that is not a window (e.g. a JInternalFrame)
		Container parent = rootPane.getParent();
		if( parent != null && !(parent instanceof Window) )
			return null;

		// Check whether root pane already has a window, which is the case when
		// switching from another LaF to FlatLaf.
		// Also check whether the window is displayable, which is required to install
		// FlatLaf native window border.
		// If the window is not displayable, then it was probably closed/disposed but not yet removed
		// from the list of windows that AWT maintains and returns with Window.getWindows().
		// It could be also be a window that is currently hidden, but may be shown later.
		if( parent instanceof Window && parent.isDisplayable() )
			install( (Window) parent );

		// Install FlatLaf native window border, which must be done late,
		// when the native window is already created, because it needs access to the window.
		// Uninstall FlatLaf native window border when window is disposed (or root pane removed).
		// "ancestor" property change event is fired from JComponent.addNotify() and removeNotify().
		PropertyChangeListener ancestorListener = e -> {
			Object newValue = e.getNewValue();
			if( newValue instanceof Window )
				install( (Window) newValue );
			else if( newValue == null && e.getOldValue() instanceof Window )
				uninstall( (Window) e.getOldValue() );
		};
		rootPane.addPropertyChangeListener( "ancestor", ancestorListener );
		return ancestorListener;
	}
Support for custom window decorations with native window border.

@author Karl Tauber
@since 1.1
flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatNativeWindowBorder.java