import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

public class Painter
    extends Applet {

  private int xValue = -10, yValue = -10;

  public void paint(Graphics g) {
    g.drawString("Drag the mouse to draw", 10, 20);
    g.fillOval(xValue, yValue, 4, 4);
  }

  //Override Component class update method to allow all ovals
  // to remain on the screen by not clearing the background
  public void update(Graphics g) {
    paint(g);
  }

  public boolean mouseDrag(Event evtObj, int x, int y) {
    xValue = x;
    yValue = y;
    repaint();
    return true;
  }

}
