Basically: my JTable wants special row-heights for each row. Each renderer used writes its requested row-height for each cell to a map in the table, the table has a method updateRowHeights
which uses the map to set the row-heights. The problem is that the map with row-heights is only filled with heights by the renderer. Hence, the first time the table is rendered the map is still empty. Therefore, when the table is displayed the first time the row-heights are not set.
As a not-so-pretty workaround I have added a component listener to my table which updates the row-heights. This works fine most of the time, but for example it is not called when the table lives in a scrollpane inside a tabbedpane. Preferably I would have a method onRenderingFinished
or something like that, in which I can call the row-heights method.
I am doing something like in the first answer of How to set the RowHeight dynamically in a JTable. There it is mentioned that you should not change the rowheights of your table from within the renderer (I agree with that) and that "you set it (call updateRowHeight
) once after the initialization is completed and whenever any of the state it depends on is changed."
So my question is: where/when do I call updateRowHeight
?
Is there an event that tells me the renderer is finished?