// hooking up a custom cell renderer // given TableCellRenderer renderer, JTable jTable and Class renderClass if ( renderClass == Object.class || renderClass == null ) { /* ignore renderClass and install on each column */ TableColumnModel tm = jTable.getColumnModel(); int columns = tm.getColumnCount(); for ( int i=0; i<columns; i++ ) { TableColumn tc = tm.getColumn( i ); tc.setCellRenderer( renderer ); } } else { /* install on just renderClass */ jTable.setDefaultRenderer( renderClass, renderer ); }