What should be invoked /fired when I added new column to the table but its header label has more lines (using html
and br
element) than in the already presents headers so the headers will resize accordingly?
Before adding
After adding
This does not happen if when first painting the table a column already has that number of rows (when the label is <html>Card<br>name</html>
).
I fire fireTableStructureChanged()
in TableModel
when new record is added (so new columns are added).
Starting from @mKorbel's example, the following button alters the appearance as shown. The method
setColumnIdentifiers()
ofDefaultTableModel
invokesfireTableStructureChanged()
on your behalf. If you extendAbstractTableModel
, you should do this from within yourTableModel
.Code: