I have a JTable such that:
ID #: Name:
0 Entry 0
1 Entry 1
2 Entry 2
When a variable:
private int HighlightEntryID = 2;
is set to an ID #, the JTable should then be able to highlight the corresponding entry.
I have created a Custom Cell Renderer and with the following code:
TableColumn column = CISTable.getColumnModel().getColumn(0);
column.setCellRenderer(new CustomCellRenderer());
I render cells based on the ID # column. My questions are:
- It only highlights a specific (row, column) entry. I want to highlight the whole row. How do I highlight other columns in the same row?
- When the variable: HighlightEntryID is changed, the JTable doesn’t automatically reflect the change. I must refresh the table manually. How do I refresh it automatically?
I like to use Table Row Rendering for this.
Invoke the following to force repainting of the entire table: