Hello,
I have a JTable that I update very regularly from callbacks (messages
received from a server, with the "message reader" being
single-threaded).
so far I've been using:
SwingUtilities.invokeLater( new Runnable() { public void run() {
setValueAt(updateValue, updateRow, updateCol);
}});
however, I've just found this comment on the sun website:
"JTable does its rendering in an Event Dispatch Thread, so renderers
executes their code in this thread, and there is no need to use
invokeLater."
(
http://forum.java.sun.com/thread.jspa?threadID=525989&messageID=2523958
)
what should I do ? am I doing more than needed ? especially considering
that performance is an issue.
for info, the JTable cell values (and colors) are changed very often,
but are seldom "read" (only a few times do I click on one cell to
extract the value displayed).
thanks for your feedback !
Antoine
PorkyCat - 21 Jan 2005 17:03 GMT
Well, they're correct, the renderers DO get called on the swing event
thread.
However, that's not the issue. It all hangs on which thread your update
callbacks are occuring. If it's not the Swing thread, then you need to
use invokeLater.
Sounds like you're doing the right thing.
Steve
> Hello,
>
[quoted text clipped - 7 lines]
> setValueAt(updateValue, updateRow, updateCol);
> }});
> however, I've just found this comment on the sun website:
>
> "JTable does its rendering in an Event Dispatch Thread, so renderers
> executes their code in this thread, and there is no need to use
> invokeLater."
> (
http://forum.java.sun.com/thread.jspa?threadID=525989&messageID=2523958
> )
>
[quoted text clipped - 8 lines]
>
> Antoine