开发者

How do I get an event after the JTable GUI has been updated?

开发者 https://www.devze.com 2023-04-03 14:06 出处:网络
I\'m currently listening for the TabelModel\'s tableChanged() event however, this event fires before the JTable has actually updated/added the row to the GUI. I\'m trying to re-adjust the table height

I'm currently listening for the TabelModel's tableChanged() event however, this event fires before the JTable has actually updated/added the row to the GUI. I'm trying to re-adjust the table heights and need to know when the JTable has finished adding and displaying the row & it'开发者_JS百科s contents.

Or is it possible to make the JTable set the row Height to the size of the component in each row? I tried to do so inside getCellRenderer but this just causes an endless loop of firing a tableChanged event.


Wrap your code in the TableModelListener in a SwingUtilities.invokeLater(...). Thats adds the code to the end of the EDT so the table update should be completed when it executes.

0

精彩评论

暂无评论...
验证码 换一张
取 消