Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2005

Tip: Looking for answers? Try searching our database.

invokeLater and JTables

Thread view: 
antoine - 21 Jan 2005 01:54 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.