code: @Override
      public void paintIcon(Component c, Graphics g, int x, int y) {
          Graphics2D g2d = (Graphics2D) g.create();
          g2d.translate(x, y);
  
          double coef1 = (double) this.width / (double) getOrigWidth();
          double coef2 = (double) this.height / (double) getOrigHeight();
          g2d.scale(coef1, coef2);
          paint(g2d);
          g2d.dispose();
      }
docs: /*
  (non-Javadoc)
  @see javax.swing.Icon#paintIcon(java.awt.Component, java.awt.Graphics, int, int)