code: public boolean isInState(JComponent c) {
          if (c instanceof JButton && c.getParent() != null && c.getParent() instanceof JTextComponent) {
              c = (JComponent) c.getParent();
          } else if (!(c instanceof JTextComponent)) {
              return false;
          }
  
          if (!"search".equals(c.getClientProperty("JTextField.variant"))) {
              return false;
          }
  
          Object o = c.getClientProperty("JTextField.Search.FindPopup");
  
          return (o != null && o instanceof JPopupMenu);
      }
docs: {@inheritDoc}