renderIcon(g, r, getLoadingImageIcon());  imageIcon.setImageObserver(getContainer()); return; }
g.drawImage(image, r.x, r.y, r.width, r.height, observer);
  public void paint(Graphics g, Shape bounds)  {    Rectangle r = bounds.getBounds();    if (imageIcon == null)      {        // Loading image on demand, rendering the loading icon so far.        reloadImage(true);                 // The reloadImage sets the imageIcon, unless the URL is broken         // or malformed.        if (imageIcon != null)          {            if (imageIcon.getImageLoadStatus() != MediaTracker.COMPLETE)              {                // Render "not ready" icon, unless the image is ready                // immediately.                renderIcon(g, r, getLoadingImageIcon());                // Add the listener to repaint when the icon will be ready.                imageIcon.setImageObserver(getContainer());                return;              }          }        else          {            renderIcon(g, r, getNoImageIcon());            return;          }      }    imageState = (byte) imageIcon.getImageLoadStatus();    switch (imageState)      {      case MediaTracker.ABORTED:      case MediaTracker.ERRORED:        renderIcon(g, r, getNoImageIcon());        break;      case MediaTracker.LOADING:      // If the image is not loaded completely, we still render it, as the      // partial image may be available.      case MediaTracker.COMPLETE:      {        // Paint the scaled image.        Image scaled = imageIcon.getImage().getScaledInstance(                                                              r.width,                                                              r.height,                                                              Image.SCALE_DEFAULT);        ImageIcon painter = new ImageIcon(scaled);        painter.paintIcon(getContainer(), g, r.x, r.y);      }        break;      }  }