Originally posted by Ulf Dittmer:
You can iterate through the TableColumns, and for each column set the TableCellRenderer you want to use.
It's been years since I last used custom renderers (Java 1.1/Swing 1.1.1 timeframe), but back then they slowed down graphics tremendously.
The trouble with custom TableCellRenderers in this example (getting foreground color to depend on the data in a row) is that you typically have different types of data in different columns (simple strings, numbers, dates, currency, etc...) so you'll need to define different custom TableCellRenderers for different types of data and that's too much work. Overriding that one JTable method cuts accross renderers and does what you need to do.