Hi everyone,

I am a C/C++ winapi developer and have to rewrite a "Dialog based" application in java, so that it will execute as an applet in any browser.

My java skills are very few, since my knowledge is limited to past college classes.

The application is not a large scale one, since it only implements a GUI, with a few screen interactions, which are driven by data from udp network connections.

In a windows development model, i would create worker threads wich handle the network communication and feed the gui with data through the window message queue, probably using SendMessage or PostMessage functions.

So my question is, how do i implement this kind of model in java?
I am not interested, for the time being, in learning another model of thread communication, i just want to know if there is anyway to apply the same model in java, because i am quite familiar with it.

Thanks in advance!

you're going to have to learn Java if you're going to use it, there's no way around it.
Trying to push an entirely different development model into the language isn't going to get you very far.
With your attitude you're setting yourself up for a very rapid failure.

Follow some Swing and applet tutorials, and you'll see instantly that what you're trying to do isn't going to work.

Thanks for the insight.
I am not trying to apply the exact same model. All i want is a suggestion on which thread communication model is closer to the one i described. I am going to learn java eventually, but i just need to implement something based on a model i allready know.
For instance this article only suggests 8 different thread communication approaches.
So all i need is someone who has experience in both languages to tell me which way is going to be easier for me to understand and implement.

I know it's wrong but i don't have the time to read entire books and get in depth knowledge of java.
I find it more helpful to try developing something and getting to know each concept on its own.


Thanks James, i've read about the BlockingQueue, and it seems like a nice and clean solution for message passing, but it is not event driven and it leaves the implementation of the dispatching to you.

This seems like a more transparent way to implement it :
Do you have any experience on this subject?
Would you suggest it?

Thanks again.

Yes yes! YES. That's exactly the "Observable" pattern that I recommended earlier. It's how the Java API handles re-painting windows when required, responding to keystrokes or mouse events, everything. Java maintains its own event queue, but it dispatches the events by calling registered "listeners" ("callbacks") for each type of event. It's a way that any experienced Java programmer would do this.

You define an interface (one or mode method signatures) for passing network events. Your GUI implements that interface, and registers itself as a listener on thr network handler. When a network event happens, the network handler calls all the registered listeners, passing the relevant data.

Being familiar with callbacks, it was easier for me to understand it that way!
Java's abstraction is really great, but it takes sometime to get used to it i suppose, specially if you are used to old-school winapi development!