Chapter 19: Taking Action with Threads

p. 462: There's a line break problem with the inline code.

p. 464: Rather than stopping and starting the Thread t when the user clicks the mouse, you should call t.suspend() and t.resume() instead. Furthermore the applet should have start and stop methods that suspend and resume the thread as well, so it doesn't waste CPU cycles while the user isn't looking at it. You should note that the applet's start and stop methods are completely different from a Thread's start and stop methods. By defalut an applet's start and stop methods do nothing, but a thread's start method calls the thread's run method and a thread's stop method stops the thread from running prematurely. It is not uncommon to call a thread's start or stop method from an applet's start or stop method, but this is not required. The new code is on theexample page.

p. 467: Program 19.10 carries the same caveats as Program 19.9; i.e. it should use suspend() and resume() in place of start() and stop(). The applet should also have its own start and stop methods. The new code is on theexample page.

Examples from Other Chapters
[ Cafe Au Lait | Books | Trade Shows | Links | FAQ | Tutorial | User Groups ]
Copyright 1996 Elliotte Rusty Harold
Last Modified October 10, 1996