private static Object getDesktopOrApplication() throws Exception {
		if( SystemInfo.isJava_9_orLater )
			return Desktop.getDesktop();
		else if( SystemInfo.isMacOS ) {
			try {
				Class<?> cls = Class.forName( "com.apple.eawt.Application" );
				return cls.getMethod( "getApplication" ).invoke( null );
			} catch( Exception ex ) {
				LoggingFacade.INSTANCE.logSevere( null, ex );
				throw new UnsupportedOperationException();
			}
		} else
			throw new UnsupportedOperationException();
	}
Sets a handler which is invoked when the application should quit.
The handler must invoke either {@link QuitResponse#performQuit} or
{@link QuitResponse#cancelQuit}.
<p>
Useful for macOS to get notified when user clicks menu item "MyApp &gt; Quit".
<p>
Uses:
<ul>
<li>Java 8 on macOS: com.apple.eawt.Application.getApplication().setQuitHandler(com.apple.eawt.QuitHandler)
<li>Java 9+: java.awt.Desktop.getDesktop().setQuitHandler(java.awt.desktop.QuitHandler)
</ul>
flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/FlatDesktop.java