@Override
  public void paint(Graphics g, JComponent c) {
    ImageComponent ic = (ImageComponent)c;
    if (ic != null) {
      ImageDocument document = ic.getDocument();
      BufferedImage image = document.getValue(ic.getZoomFactor());
      if (image != null) {
        if (ic.isFileSizeVisible() && ic.isBorderVisible()) paintBorder(g, ic);

        Dimension size = ic.getCanvasSize();
        Graphics igc = g.create(ImageComponent.IMAGE_INSETS, ImageComponent.IMAGE_INSETS, size.width, size.height);

        // Transparency chessboard
        if (ic.isTransparencyChessboardVisible() && image.getTransparency() != Transparency.OPAQUE) {
          paintChessboard(igc, ic);
        }

        paintImage(igc, ic);

        // Grid
        if (ic.isGridVisible()) {
          paintGrid(igc, ic);
        }

        igc.dispose();
      }
    }
  }
@Override
  public void paint(Graphics g, JComponent c)