Here you can find the source of getIconImage(Icon icon)
public static Image getIconImage(Icon icon)
//package com.java2s; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; import javax.swing.Icon; import javax.swing.ImageIcon; public class Main { /**/* w w w .j av a 2 s .c o m*/ * @return an image for the specified icon. */ public static Image getIconImage(Icon icon) { if (icon instanceof ImageIcon) { ImageIcon imageIcon = (ImageIcon) icon; return imageIcon.getImage(); } else { Image image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = (Graphics2D) image.getGraphics(); icon.paintIcon(null, g2, 0, 0); icon = new ImageIcon(image); g2.dispose(); return image; } } }