1 package edu.jiangxin.apktoolbox.file.duplicate; 2 3 import javax.swing.*; 4 import javax.swing.table.DefaultTableCellRenderer; 5 import java.awt.*; 6 7 public class DuplicateFilesTableCellRenderer extends DefaultTableCellRenderer { 8 @Override 9 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { 10 int groupNo = (Integer) table.getValueAt(row, 0); 11 setBackground(DuplicateFilesConstants.BACKGROUND.get(groupNo % DuplicateFilesConstants.BACKGROUND.size())); 12 return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); 13 } 14 }