Object content = this.url.getContent();
ImageProducer producer;
try {
producer = (ImageProducer) content;
}
catch (ClassCastException e) {
throw new IOException("Unexpected type " + content.getClass());
}
if (producer == null) theImage = null;
else {
theImage = this.createImage(producer);
int width = theImage.getWidth(this);
int height = theImage.getHeight(this);
// add space for title bar on top
height += this.getInsets().top;
if (width > 0 && height > 0) this.setSize(width, height);
}