private static void setHandler( String setHandlerMethodName, String handlerClassName,
		Runnable handler )
	{
		try {
			Object desktopOrApplication = getDesktopOrApplication();
			Class<?> handlerClass = Class.forName( handlerClassName );

			Method m = desktopOrApplication.getClass().getMethod( setHandlerMethodName, handlerClass );
			m.invoke( desktopOrApplication, Proxy.newProxyInstance( FlatDesktop.class.getClassLoader(),
				new Class[] { handlerClass },
				(proxy, method, args) -> {
					// Use invokeLater to release the listener firing for the case
					// that the action listener shows a modal dialog.
					// This (hopefully) prevents application hanging.
					EventQueue.invokeLater( () -> {
						handler.run();
					} );
					return null;
				} ) );
		} catch( Exception ex ) {
			LoggingFacade.INSTANCE.logSevere( null, ex );
		}
	}
Sets a handler to show a custom Preferences dialog.
<p>
Useful for macOS to enable menu item "MyApp &gt; Preferences".
<p>
Uses:
<ul>
<li>Java 8 on macOS: com.apple.eawt.Application.getApplication().setPreferencesHandler(com.apple.eawt.PreferencesHandler)
<li>Java 9+: java.awt.Desktop.getDesktop().setPreferencesHandler(java.awt.desktop.PreferencesHandler)
</ul>
flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatDesktop.java