Lots and lots of geometry! Move the mouse and it will calculate what angles the joints need to be in order for the paddle to remain in a desired direction and the end of it to be touching the mouse. The dashed circles are min/max ranges of the arm. Play around with it, see how it works!
I actually made a 3D version of this with Unity, and hooked it up to an Arduino so that I can have a real robotic arm (currently made of tiny servos, popsicle sticks, and hot glue) move to reflect what's on the screen! It is amazing!