user1066163
user1066163

Reputation: 53

TableCellRenderer lost

I've got an ArrayList bound to a JTable. After

 bindingGroup.unbind(); 
 bindingGroup.bind(); 

(done to refreshing data) I lost table cell renderer behavior.

Any suggestions?

Upvotes: 3

Views: 268

Answers (1)

camickr
camickr

Reputation: 324207

I don't know what the bind() methods do, but if they refresh the table by changing the model then the TableColumnModel is being recreated which causes you to lose any custom renderer you added to the table.

One solution is to add the renderer back to the table after you invoke the bind() methods.

Or after you create the JTable you can use:

table.setAutoCreateColumnsFromModel(false); 

to prevent the TableColumnModel from being recreated.

Upvotes: 1

Related Questions