public void paint(Graphics g) {
    if (myCachedImage != null && myMagnificationPoint != null) {
      double scale = magnificationToScale(myMagnification);
      int xOffset = (int)(myMagnificationPoint.x - myMagnificationPoint.x * scale);
      int yOffset = (int)(myMagnificationPoint.y - myMagnificationPoint.y * scale);

      Rectangle clip = g.getClipBounds();

      g.setColor(myContentComponent.getBackground());
      g.fillRect(clip.x, clip.y, clip.width, clip.height);

      Graphics2D translated = (Graphics2D)g.create();
      translated.translate(xOffset, yOffset);
      translated.scale(scale, scale);

      UIUtil.drawImage(translated, myCachedImage, 0, 0, null);
    }
  }
public void paint(Graphics g)