To draw graphics onto a panel, you must define a class that extends Panel, and then override the paint method in the class (or paintComponent, if using Swing). The paint method takes one Graphics parameter, which has methods to draw patterns, images, and text. Each time a window needs to be redrawn (e.g if it is placed behind another window, and then brought to the front), the Java event handler notifies the window and the paint (or paintComponent) methods of all the window's components are called. You do not need to call the paint method yourself.