@Override
  public void eventDispatched(AWTEvent event) {
    if (event.getID() != WindowEvent.WINDOW_OPENED) {
      return;
    }

    JBPopupFactory jbPopupFactory = getPopupFactory();
    if (jbPopupFactory == null) {
      return;
    }

    WindowEvent we = (WindowEvent)event;
    for (JBPopup each : jbPopupFactory.getChildPopups(this)) {
      if (!each.isDisposed() && SwingUtilities.isDescendingFrom(each.getContent(), we.getWindow())) {
        super.setPopupVisible(false);
      }
    }
  }
@Override
  public void eventDispatched(AWTEvent event)