/* Scribble, an applet which lets the user scribble on the screen with the mouse. Uses Java 1.0 event model */ import java.awt.*; import java.applet.Applet; public class Scribble extends Applet { private int lastX = 0, lastY = 0; // Called when the user depresses the mouse. public boolean mouseDown(Event e, int x, int y) { lastX = x; // Remember the location of the click. lastY = y; return true; } public boolean mouseDrag(Event e, int x, int y) { Graphics g = this.getGraphics(); // Get a Graphics object to draw with g.drawLine(lastX, lastY, x, y); // Draw a line from the last point to this. lastX = x; // Update the saved location lastY = y; return true; } }