There is a case where the header of a table component that is set to stretch to fit will not fit correctly:
Uncomment this line in JUCE Demo, TableDemoComponent constructor:
Run JUCE Demo, choose Demo:Table Components
Stretch the demo window to 3 times its initial width
From left to right, make each column smaller in this order:
ID, Artist, Song, Album, Rating, Genre
Result:
At some point the Genre column will stop stretching, instead it will move to the left. Its right edge will move to the left. Making any change to the enclosing window size will cause the table header to snap back to the way it should be.
This only happens when the columns are resized in the order given. Any attempt to resize a column out of order will either not exhibit the bug, or cause the Genre column to stretch appropriately.