private static void paintThumbnail(Graphics g, ImageComponent imageComponent, int blankHeight) {

    // Zoom image by available size
    int maxWidth = ImagesIcons.ThumbnailBlank.getIconWidth() - 10;
    int maxHeight = blankHeight - 10;

    BufferedImage image = imageComponent.getDocument().getValue();
    int imageWidth = image.getWidth();
    int imageHeight = image.getHeight();

    if (imageWidth > maxWidth || imageHeight > maxHeight) {
      if (imageWidth > maxWidth) {
        double proportion = (double)maxWidth / (double)imageWidth;
        imageWidth = maxWidth;
        imageHeight = (int)((double)imageHeight * proportion);
      }
      if (imageHeight > maxHeight) {
        double proportion = (double)maxHeight / (double)imageHeight;
        imageHeight = maxHeight;
        imageWidth = (int)((double)imageWidth * proportion);
      }
    }

    imageComponent.setCanvasSize(imageWidth, imageHeight);
    Dimension size = imageComponent.getSize();

    int x = 5 + (ImagesIcons.ThumbnailBlank.getIconWidth() - size.width) / 2;
    int y = 5 + (ImagesIcons.ThumbnailBlank.getIconHeight() - size.height) / 2;


    imageComponent.paint(g.create(x, y, size.width, size.height));
  }
private static void paintThumbnail(Graphics g, ImageComponent imageComponent, int blankHeight)