/** {@inheritDoc} */
@RunsInEDT
@Override
public void close(@Nonnull Window w) {
WindowEvent event = new WindowEvent(w, WINDOW_CLOSING);
// If the window contains an applet, send the event on the applet's queue instead to ensure a shutdown from the
// applet's context (assists AppletViewer cleanup).
Component applet = findAppletDescendent(w);
EventQueue eventQueue = windowMonitor.eventQueueFor(applet != null ? applet : w);
checkNotNull(eventQueue).postEvent(event);