Change the background color of a row in a JTable

前端 未结 5 1178
我寻月下人不归
我寻月下人不归 2020-11-30 10:09

I have a JTable with 3 columns. I\'ve set the TableCellRenderer for all the 3 columns like this (maybe not very effective?).

 for (int i = 0; i          


        
5条回答
  •  失恋的感觉
    2020-11-30 10:41

    The other answers given here work well since you use the same renderer in every column.

    However, I tend to believe that generally when using a JTable you will have different types of data in each columm and therefore you won't be using the same renderer for each column. In these cases you may find the Table Row Rendering approach helpfull.

提交回复
热议问题