0
class CustomTableRenderer extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column)
{
Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
String s = table.getModel().getValueAt(row,12).toString();
if(s.equals("Filled") && column == 12)
{
setForeground(Color.RED);
System.out.println("Inside " + s + column);
}
return c;
}}
上記のコードを使用すると、すべての列の色が変化し、値に基づいて単一列で変更したい。セル値に基づくJtableセルのフォントの色