Java has been around for many years, but it is still a little daunting when it comes to JTABLE operations. This project encountered background color rendering for the CheckBox cell, which really gave me a hard time. Here are the solutions to share with the students who need them. [Java] for (int I = 0; I <table. getColumnCount (); I ++) {// The warning flag is displayed in the column 12th. Use the CheckBox control to display if (I = 11) {table. getColumn (table. getModel (). getColumnName (I )). setCellRenderer (new TableCellRenderer () {private JCheckBox checkBox = new JCheckBox (); @ Override public Component getTableCellRendererComponent (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {if (value! = Null) {checkBox. setSelected (Boolean. valueOf (value. toString (); checkBox. setHorizontalAlignment (JCheckBox. CENTER); if (isSelected) {// the checkBox color is selected by default. setBackground (new Color (10, 36,106);} else {String warn_Flag = (String) table. getModel (). getValueAt (row, 13); if ("1 ". equals (warn_Flag) {checkBox. setBackground (Color. RED);} else {checkBox. setBackground (Color. white) ;}}return checkBox ;}}) ;}else {table. getColumn (table. getModel (). getColumnName (I )). setCellRenderer (new DefaultTableCellRenderer () {@ Override public Component getTableCellRendererComponent (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {String warn_Flag = (String) table. getModel (). getValueAt (row, 13); if ("1 ". equals (warn_Flag) {setBackground (Color. RED);} else {setBackground (Color. white);} return super. getTableCellRendererComponent (table, value, isSelected, hasFocus, row, column) ;}); <span style = "white-space: pre" ></span> }}