示例#1
0
  /** Get the default image for objects of this class. May return null. */
  private GreenfootImage getClassImage() {
    Class<?> clazz = getClass();
    while (clazz != null) {
      GreenfootImage image = null;
      try {
        image = Actor.getDelegate().getImage(clazz.getName());
      } catch (Throwable e) {
        // Ignore exception and continue looking for images
      }
      if (image != null) {
        return image;
      }
      clazz = clazz.getSuperclass();
    }

    return null;
  }