The SmileyCanvas Example (Lecture 2)

The demo, which is actually called PaintDemo, is one of the first examples in the article "Painting in AWT and Swing" . The article deals with details not broached in Ch2 of the textbook, but it is still of use to read.
For instance, the sections up to and including "The Paint Method" serve to reinforce the textbook. We will discuss heavyweight vs lightweight components ("widgets" in the parlance of the textbook) in Lecture 3, after which the remainder of the article will be more useful to you.