Adapted from Java in a Nutshell, O'Reilly & Associates.
I've extended Nutshell's scribble applet by applying a first-order digital filer to the sampled mouse coordinates. This means the drawing will always be somewhat behind the mouse position. (Java seems to be slow enought that it is anyway.) When you release the mouse button this applet spawns a thread that keeps drawing until the line catches up to the release point.