Where are you keeping the internal representation of your line? When
you draw your line the first time, you have to keep an internal
representation of the line. When you "repaint()" you call a routine
which redraws that line on your canvas based upon your internal
representation.