FileDocCategorySizeDatePackage
Scribble.javaAPI DocExample1150Mon Sep 22 13:30:30 BST 1997None

Scribble

public class Scribble extends Applet
This applet lets the user scribble with the mouse. It demonstrates the Java 1.0 event model.

Fields Summary
private int
last_x
private int
last_y
Constructors Summary
Methods Summary
public booleanmouseDown(java.awt.Event e, int x, int y)

  // Fields to store a point in.

  // Called when the user clicks.
          
    last_x = x; last_y = y;            // Remember the location of the click.
    return true;
  
public booleanmouseDrag(java.awt.Event e, int x, int y)

    Graphics g = getGraphics();        // Get a Graphics to draw with.
    g.drawLine(last_x, last_y, x, y);  // Draw a line from last point to this.
    last_x = x; last_y = y;            // And update the saved location.
    return true;