import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.image.BufferedImage; import javax.swing.AbstractButton; import javax.swing.DefaultButtonModel; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableModel; /** * The package-private class javax.swing.JTable.IconRenderer, which is the * default renderer for columns of class Icon and ImageIcon, is known to * give rise to a ClassCastException when attempting to render an Icon whose * implementation of paintIcon(Component c, Graphics g, int x, int y) requires * a cast of its first parameter to a specific subclass of Component. Many * icons obtained from standard JDK classes trigger this ClassCastException. *

* IconTableCellRenderer addresses this issue in the following manner: *