public java . awt . Component getTableCellRendererComponent ( JTable table , Object value , boolean isSelected , boolean hasFocus , int row , int column ) { if ( m_table == null ) { // Cache this for later. m_table = table ; // The following code is here because the column of this component is sometimes different from the column in the model: TableColumnModel columnModel = table . getColumnModel ( ) ; for ( int iColumn = 0 ; iColumn < columnModel . getColumnCount ( ) ; iColumn ++ ) { TableColumn tableColumn = columnModel . getColumn ( iColumn ) ; TableCellRenderer renderer = tableColumn . getCellRenderer ( ) ; if ( renderer == this ) m_iThisColumn = column ; } } m_iThisRow = row ; ImageIcon icon = this . getImageIcon ( value ) ; this . setIcon ( icon ) ; return this ; }
If this control is in a JTable this is how to render it .