You Are Here:
TopJazzSwing > Swing Msg44952

Swing

Re: threads & swing
Date: Thu, 29 May 2003 08:11:56 +0000 (UTC)
Newsgroups: comp.lang.java.gui
Size: 1,374 bytes
"Mike" <email-address-deleted> writes:
> I am doing a bit of reading into threads & swing on java.sun.com and note
> that as a general rule swing components are not thread safe, the article
> mentions that some classes are threadsafe though. Does anyone know of a
> list of swing classes/methods which are threadsafe which will enable me to
> get an overview (rather than read the docs for all swing classes), also of
> any other sites / pages that give a general overview ?
There is some TSC article on Sun's web site outlining the principles:
http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html#exceptions
(the reality sometimes differes from this description).
But frankly said, if you intend to base your design on just using
thread-save methods, you will be deeply disapointed. Thread-save Swing
methods are a rare exception.
If you want to make the best of your time, I suggest you study the
Swing mechanisms for synchronizing with other threads (invokeLater()
and invokeAndWait()), and the implications on Swing GUI design.
If you late have a concrete task at hand, it is then only a matter of
seconds to figure out from the API documentation if you can call the
necessary Swing methods directly from another thread, or if you need to
use invoke[Later|AndWait](). You can just learn the thread-save Swing
methods while you go.
/Thomas

Site Categories:
• Broadway
• Child Song
• Christian Music
• Classical Music
• Country Music
• Dance
• Gospel Music
• Guitar Music
• Jazz
• Karaoke
• Lyric
• Metal Music
• Music
• Music Download
• Music Video
• New Age
• Rap Music
• Reggae
• Rock
• Wedding Song
• World Music