ABSTRACT

Chapter8 1TheThreadfollowsthenormalpattern,butnoticethatthemoving

loophasbeentransferredintorun().I'veusedupdate(),ratherthan paint(),asitgivesslightlysmootheranimation.

3 The tricky bit in this program is how and when you record hits and misses. If it is done solely within mouseClicked(), it would be possible to get several hits at once by repeatedly clicking on the target - and a miss would not be counted if you did not click before the target was redrawn. Using the Boolean variable ontarget, we can record - once only-when the target it hit, and failure to click also counts as a miss.