CodeBarn - How does "Shapes" work?

In the Shapes example code (http://www.javaranch.com/CodeBarn/shapes.jsp) how does the paint method get called? The main method instantiates a new ShowShapes object, which seems to have a constructor method that just sets up a window and makes it visible. From where is the paint method called? Thanks