Groovy Documentation

com.wordpress.tipsforjava.swing.table
[Java] Class IconTableCellRenderer

java.lang.Object
  java.awt.Component
      java.awt.Container
          javax.swing.JComponent
              javax.swing.JLabel
                  javax.swing.table.DefaultTableCellRenderer
                      com.wordpress.tipsforjava.swing.table.IconTableCellRenderer

public class IconTableCellRenderer
extends DefaultTableCellRenderer

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: