void (Component c, Graphics g, int x, int y) { Shape dontPaintHere = getOverlayShape(0, 0); if (dontPaintHere == null) { super.paintIcon(c, g, x, y); return; } BufferedImage img = UIUtil.createImage(((Graphics2D)g).getDeviceConfiguration(), getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB, PaintUtil.RoundingMode.CEIL); Graphics2D g2 = img.createGraphics(); getMainIcon().paintIcon(c, g2, 0, 0); GraphicsConfig config = new GraphicsConfig(g2); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR)); g2.fill(dontPaintHere); config.restore(); UIUtil.drawImage(g,img, x, y, null); getOverlayIcon().paintIcon(c, g, x, y); }