if (result != null)
if (result != null && (result.visible && result.isDisplayable() && result.enabled && result.focusable))
  public Component getFirstComponent(Container root)  {    if (root == null)      throw new IllegalArgumentException ();    if (!root.isVisible ()        || !root.isDisplayable ())    return null;    if (accept (root))      return root;    Component[] componentArray = root.getComponents ();        for (int i = 0; i < componentArray.length; i++)      {        Component component = componentArray [i];		if (accept (component))	  return component;        if (component instanceof Container)  {            Component result = getFirstComponent ((Container) component);            if (result != null)              return result;          }      }    return null;  }