View Source

h3.Threaded Programs Code Samples


A thread is a path of execution through a program. Single threaded programs have one path of execution, and multi-threaded programs have two or more paths of execution. For most programs, one thread of execution is all you need, but sometimes it makes sense to use multiple threads in a program to accomplish multiple simultaneous tasks.

* Applet Examples
* Synchronization

h5.Applet Examples

* [SlideShow.java|http://java.sun.com/developer/technicalArticles/Threads/applet/SlideShow.java] downloads three thumbnail paintings by Claude Monet and draws them one-by-one on the applet's panel. For supporting information see [Creating a Threaded Slide Show Applet|http://java.sun.com/developer/technicalArticles/Threads/applet/].

h5.Synchronization

* [Editor.java|http://java.sun.com/developer/technicalArticles/Threads/swing/Editor.java] explains how to use the {{InvokeLater}} method and {{synchronize}} keyword to ensure data integrity when modifying data in Swing components. For supporting information see [Multithreaded Swing Applications|http://java.sun.com/developer/technicalArticles/Threads/swing/].

----

The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact