You should have no difficulty
You should have no difficulty understanding any of the function calls in Listing 6.
(See the documentation for drawing primitives.)
The coordinate values specified for the rectangle and the filled rectangle specify two opposite corners of the rectangle.
The sides of the rectangle must be horizontal and vertical.