[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java Tip 68: Learn how to implement the Command pattern in Java - JavaWorld - February 1999

"P.H.Welch" wrote:

In JDK1.1, such event handling was deprecated and replaced with
a traditional (non-`object-oriented') listener-callback mecahnism.

If I understand correctly, it's not quite correct to call the listener-callback mecahnism 'non object oriented' just because it doesn't use inheritance. The term often used is the 'delegate model', I believe, as distinct from the 'inheritance model'.
My question is: does the un-thread-safeness of Swing configuration
methods just mean that we can't invoke them safely from multiple
threads?  <snip>
OR ... does the declared un-thread-safeness of Swing configuration
methods mean that they *must* be executed only by the JVM Event thread
(i.e. using `invokeLater')?  <snip>
The latter is true, except for a very few exceptions. It has to run GUI interactions in the JVM Event thread. I quote:
Rule: Once a Swing component has been realized, all code that might affect
or depend on the state of that component should be executed in the
event-dispatching thread.
URL for further reading:

Richard Beton B.Sc. C.Phys. M.Inst.P.
Roke Manor Research Limited (http://www.roke.co.uk/)
--------- Standard Disclaimer about my own views etc etc --------
---------  My mail client accepts rich text (HTML) mail  --------
Welsh Highland Railway: http://www.whr.co.uk/WHR/WHR.html