if (child != uiActionMap)
  public static void replaceUIActionMap(JComponent component,                                         ActionMap uiActionMap)  {    ActionMap child = component.getActionMap();    if (child == null)      component.setActionMap(uiActionMap);    else      {        ActionMap parent = child.getParent();        while (parent != null && !(parent instanceof ActionMapUIResource))          {            child = parent;            parent = child.getParent();          }          child.setParent(uiActionMap);      }  }