@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (image == null) { image = new BufferedImage(getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB); double coef = Math.min((double) width / (double) 68, (double) height / (double) 81); Graphics2D g2d = image.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.scale(coef, coef); paint(g2d); g2d.dispose(); } g.drawImage(image, x, y, null); }