throw new NullPointerException();
}
final Object o = imageResource.getResource();
if (o instanceof Image == false)
{
throw new ResourceException("ImageResource does not contain a java.awt.Image object.");
}
final ResourceKey resKey = imageResource.getSource();
final Object identifier = resKey.getIdentifier();
if (identifier instanceof URL)
{
this.url = (URL) identifier;
}
this.resourceKey = resKey;
this.image = (Image) o;
final WaitingImageObserver obs = new WaitingImageObserver(image);
obs.waitImageLoaded();
if (obs.isError())
{
throw new ResourceException("Failed to load the image. ImageObserver signaled an error.");
}
this.width = image.getWidth(null);
this.height = image.getHeight(null);
}