@Override
        public boolean dispatch(@NotNull AWTEvent e) {
          if (e instanceof KeyEvent && e.getID() == KeyEvent.KEY_PRESSED) {
            boolean isEsc =  ((KeyEvent)e).getKeyCode() == KeyEvent.VK_ESCAPE;
            if (isEscWasPressed && isEsc) {
              myPopup.cancel();
            }
            isEscWasPressed = isEsc;
          }
          return false;
        }
@Override
        public boolean dispatch(@NotNull AWTEvent e)