/* MouseDown2 draws a circle where the mouse
          is clicked. Observe that the previous circle is
          automatically erased. */




       import java.awt.*;
       import java.applet.*;



       public class MouseDown2 extends Applet {

         int x;
         int y;


         public void init() {
            setBackground(Color.red);
         }


         public boolean mouseDown(Event evt, int x, int y) {
           this.x = x;
           this.y = y;
           repaint();           // request to be repainted
           return true;
        }


         public void paint(Graphics g) {
           g.setColor(Color.blue);
           g.fillOval( x, y, 25, 25);
         }

       }