You will need to add a mouse motion listener to the component that is responsible for painting your collection of shapes. Within that listener, detect if the cursor falls within a shape by using the Shape.contains() method. Set the tooltip text of the component accordingly.
Note that a Line2D has no area so contains() will only return true for points which lie exactly on the line. You may wish to store a stroked version of shapes to give some 'fuzziness' (see BasicStroke and Stroke.createStrokedShape()).