Your question and posted code don't make any sense.
The paintComponent() method is used by Swing components, not AWT components. Your example is for an AWT
applet.
Swing applets should never be written this way. When creating a Swing applet you would extend JApplet. If you wanted to do custom painting you would override the paintComponent() method of a JPanel (or JComponent) and then add the panel to the content pane of the applet.
The repaint() method will invoke paint(). In a Swing application the paint() method is responsible for invoking paintComponent() along with other methods. See
Painting in AWT and Swing for a detailed explanation.