/* MouseDown3 draws a circle where the mouse is clicked. Notice that this example overrides the update() method to prevent the automatic erasing of the background. */ import java.awt.*; import java.applet.*; public class MouseDown3 extends Applet { int x; int y; public void init() { setBackground(Color.black); } public boolean mouseDown(Event evt, int x, int y) { this.x = x; this.y = y; repaint(); // request to be repainted return true; } public void update(Graphics g) { // override to avoid paint(g); // erasing background } public void paint(Graphics g) { g.setColor(Color.red); g.fillOval( x, y, 25, 25); } }