Painting into Graphics Example
public class ShapesApplet extends Applet {
static final String message = "Shapes!";
myFont = new Font("Helvetica", Font.BOLD, 36);
public void paint(Graphics g) {
g.setFont(myFont); // set the Helvetica font
g.drawString(message, 150, 30); // draw the text
g.drawRect(10, 50, 80, 50);
g.fillRect(10, 130, 80, 130); // draw 2 rectangles