JTF > Demo Gallery > acm.graphics > DrawLine

This program makes it possible to construct a line drawing by creating a line between the point at which the mouse is pressed and the point at which is released. As the user drags the mouse, the current line is always connected from its starting point to the mouse position. In graphics, this technique is called rubber-banding.