Drag and drop graphics with linke lines

I want to know how to linke a couple of lines to a couple of square and that the lines can move with the squares
Can Someone sent me the source codes please
thank you very much