Is "mainPaint" even a object?
In order to pull of something like this you will need to make a rectangle, then wherever you click on the rectangle get that (x,y) value and wherever your mouse ends up calculate the new (x,y) value. Then you also have to calculate the corresponding (x,y) values for the strings you are painting (relative positioning seems best for this). I dunno what those two methods above were about