JTable with striped background

前端 未结 5 1344
北恋
北恋 2021-02-06 06:14

Using a different background color for odd and even rows is a commonly used trick to improve readability of large tables.

I want to use this effect in Swing\'s JTable.

5条回答
  •  醉酒成梦
    2021-02-06 06:41

    Use Table Row Rendering concepts which is easier than dealing with individual renderers.

    This approach only works for rendered cells. If you want to paint outside the bounds of the table, then you will need to override the paintComponent() method to add custom painting.

提交回复
热议问题