In my opinion creating a custom event would be nothing different from writing a polling thread which keeps listening to the port you are interested. And as soon as it finds some data on the port it fires the event.
Fundamentally every event should have a code which triggers it and then all listeners would listen for that trigger to initiate.
So I think serial port reader event would be a polling code which keeps watch over the serial port and as soon as you find an activity you should trigger it.
By the way ...why do you want to write a event code for this?
Thanks, that's what I was told by others of what you had to do.
Honestly, threads aren't my strong point, so I was crossing my fingers that there was something else I could use.
I have this device that I'm connecting to through a serial port. It sends out data, and then reads data. It's for my company. I'm an intern here, and my understanding of J2ME is limited...that's why I'm going around asking for help.
Threads can be scary to start with, but like anything else in Java, after using them a few times they get comfortable.
I would suggest taking a long look at the java.util.concurrent package, it will help you a lot. For example, the ExecutorServices make generating and monitoring Threads and Thread Pools easy.
The various implementations of BlockingQueue make good tools for event dispatching (your event dispatcher thread listening to the Serial Port put()s an event in the Queue, and the event consumer thread take()s from the BlockingQueue). [ August 11, 2008: Message edited by: Steve Luke ]