code: public static <T> T findAtOrAbove( Component start, Class<T> aClass )
    {
      Component comp = start;
      while( comp != null )
      {
        if( aClass.isInstance( comp ) )
        {
          return (T)comp;
        }
        else
        {
          comp = comp.getParent();
        }
      }
      return null;
    }
docs: Finds the first widget at or above the passed in widget of the given class