>> Since you are using the Swing Timer, you are guaranteed that the
>> actionPerformed method will be invoked on the EDT. Similarly, your
[quoted text clipped - 14 lines]
> EDT one?
> -Will
Generally, you can repeat the pattern that Swing took (BTW, you should
use EventQueue.invokeLater, not SwingUtilities)
You can create a "message queue" for your serial port, and have a single
thread that reads from that queue and writes the data to your port. You
would have another thread who's job it is to read from and respond to
the serial data coming in. Quite possibly that thread would pass the
actual data off to something in the event queue.

Signature
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
Lew - 06 Feb 2008 01:04 GMT
>>> Since you are using the Swing Timer, you are guaranteed that the
>>> actionPerformed method will be invoked on the EDT. Similarly, your
[quoted text clipped - 22 lines]
> the serial data coming in. Quite possibly that thread would pass the
> actual data off to something in the event queue.
You can also use
<http://java.sun.com/javase/6/docs/api/javax/swing/SwingWorker.html>
to invoke jobs off the EDT.

Signature
Lew
Stanimir Stamenkov - 06 Feb 2008 09:55 GMT
Tue, 05 Feb 2008 13:56:55 -0800, /Daniel Pitts/:
> (BTW, you should
> use EventQueue.invokeLater, not SwingUtilities)
"Transcript of Ask the Experts session on Swing"
<http://java.sun.com/developer/community/askxprt/2006/jl1016.html>:
> *M Dunn*: Starting a Swing app. I've seen a couple of recommended
> ways:
[quoted text clipped - 22 lines]
> comes down to what you prefer. After all these years my fingers
> can't type anything but SwingUtilities. :)

Signature
Stanimir
Daniel Pitts - 06 Feb 2008 17:03 GMT
> Tue, 05 Feb 2008 13:56:55 -0800, /Daniel Pitts/:
>
[quoted text clipped - 27 lines]
>> down to what you prefer. After all these years my fingers can't type
>> anything but SwingUtilities. :)
From my understanding, SwingUtilities was a stopgap for Swing to use
before AWT implemented and used the EventQueue. It has used the
EventQueue for long enough that you can use it yourself safely.
I wouldn't say one was so much better than the other that its worth
considerable consternation trying to figure out which one to use. I
prefer and suggest using EventQueue, but I'm not going to search/replace
someone else codebase to match.

Signature
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
>What should I
>do in that case, or any other case where I know for sure or at least
>strongly suspect that the thread manipulating the data will not be the
>EDT one?
same as any other pair of threads. You use locks on objects with
synchronized, volatile etc. You read Doug Lea's book.
See http://mindprod.com/jgloss/thread.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com