/** * Creates an {@link ImageIcon} with a Shadow * * @param buf * , the {@link Image} where a Shadow will be applied * @return {@link ImageIcon} with shadow */ public static ImageIcon createShadowPicture(Image buf) { buf = removeTransparency(buf); BufferedImage splash; JLabel label = new JLabel(); int width = buf.getWidth(null); int height = buf.getHeight(null); int extra = 4; splash = new BufferedImage(width + extra, height + extra, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = (Graphics2D) splash.getGraphics(); BufferedImage shadow = new BufferedImage(width + extra, height + extra, BufferedImage.TYPE_INT_ARGB); Graphics g = shadow.getGraphics(); g.setColor(new Color(0.0f, 0.0f, 0.0f, 0.3f)); g.fillRoundRect(0, 0, width, height, 12, 12); g2.drawImage(shadow, getBlurOp(7), 0, 0); g2.drawImage(buf, 0, 0, label); return new ImageIcon(splash); }