Re: opening a window from an applet..



Frances wrote:
>
now these invokeAndWait and invokeLater -- are THESE the event-handling threads?
(I was not able to compile code you posted (MyApp.java and frame.java..)

These are methods that take a Runnable object and pass it over to the EDT where it is run.


The difference between the two is that invokeLater just sends the task off to be run but returns immediately, whereas invokeAndWait sends the task off, waits for it to complete and transfers any exception to the calling thread.

I do understand basic concept of threads (to run several processes at the same time, let's say several connections from a client to a server, or several simultaneous connections to a db...) but I don't understand why you need to do this to display Swing GUI elements..

If you had multiple threads all accessing the same objects at the same time you'll get a mess. Having one thread to access a bunch of objects is equivalent to throwing a big synchronize around the lot for every possible route to access them.


Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
.