I designed a JTable
with Netbeans Builder and I created 5 columns, the 5th one is Boolean
so I want to know how to highlight whole the row when the user selected.
See Table Row Rendering for an easy way to color an entire row based on a value in the row.
The problem now is that only the cell is automatically repainted when you click on the checkbox so you will also need to add a TableModelListener
to the TableModel
so you can invoke a repaint()
on the table row whenever the state of the checkbox is changed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.