FileDocCategorySizeDatePackage
Scribble2.javaAPI DocExample1845Mon May 19 18:23:14 BST 1997None

Scribble2

public class Scribble2 extends Applet implements MouseListener, MouseMotionListener

Fields Summary
private int
last_x
private int
last_y
Constructors Summary
Methods Summary
public voidinit()

    // Tell this applet what MouseListener and MouseMotionListener
    // objects to notify when mouse and mouse motion events occur.
    // Since we implement the interfaces ourself, our own methods are called.
    this.addMouseListener(this);
    this.addMouseMotionListener(this);
  
public voidmouseClicked(java.awt.event.MouseEvent e)

;
public voidmouseDragged(java.awt.event.MouseEvent e)

    Graphics g = this.getGraphics();
    int x = e.getX(), y = e.getY();
    g.drawLine(last_x, last_y, x, y);
    last_x = x; last_y = y;
  
public voidmouseEntered(java.awt.event.MouseEvent e)

;
public voidmouseExited(java.awt.event.MouseEvent e)

;
public voidmouseMoved(java.awt.event.MouseEvent e)

;
public voidmousePressed(java.awt.event.MouseEvent e)

    last_x = e.getX();
    last_y = e.getY();
  
public voidmouseReleased(java.awt.event.MouseEvent e)

;