看板 java 關於我們 聯絡資訊
感謝您的回答。 想法有點不太一樣,前輩的做法是update符合的cell而已。 而我想要的是整個row的顏色。 不過,我已經試出方法了。 就是 public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); int VALIDATION_COL = 4; boolean isEnabled = Boolean.parseBoolean( table.getModel().getValueAt(row, VALIDATION_COL).toString()); if(isEnabled) { cell.setBackground(Color.BLUE); } else { cell.setBackground(Color.RED); } return cell; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.95.190.120