code: protected void postClosingEvent(JInternalFrame frame) {
          InternalFrameEvent e = new InternalFrameEvent(frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
  
          // Try posting event, unless there's a SecurityManager.
          if (JInternalFrame.class.getClassLoader() == null) {
  
              try {
                  Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
  
                  return;
              } catch (SecurityException se) {
                  // Use dispatchEvent instead.
              }
          }
  
          frame.dispatchEvent(e);
      }
docs: Post a WINDOW_CLOSING-like event to the frame, so that it can be treated
  like a regular Frame.
  
  @param frame the internal frame to be closed.