// Dori Smith's simple line-drawing applet // Posted by RP Futrelle, 6/30/01 import java.awt.*; import java.applet.*; public class Applet1 extends Applet { Point startPt; Point endPt; public void init() { setBackground(Color.white); } public boolean mouseDown(Event evt, int x, int y) { startPt = new Point(x, y); return true; } public boolean mouseDrag(Event evt, int x, int y) { endPt = new Point(x, y); repaint(); return true; } public boolean mouseUp(Event evt, int x, int y) { endPt = new Point(x,y); repaint(); return true; } public void paint(Graphics g) { if (endPt != null) { g.drawLine(startPt.x, startPt.y, endPt.x, endPt.y); } } }