Adding texture/sprite to a distance joint

How would I go about adding a graphic to a distance joint? I know uncommenting the debug will show the joint, but I don't want to use this for my game. Also, I checked out the verlet code sample, but I wanted to know if there is another way. Tried adding sprite to the userdata for a b2DistanceJointDef, but that didn't work.
You can get the two anchor points of the joint in world coordinates with these functions, that will give you the two points to draw something between.
GetAnchorA()
GetAnchorB()
In terms of the details would I first create the appropriate bodies in box2d with the right shape and then set the user data for these bodies with a sprite? Then I could I weld the bodies to the distance joint endpoints? Or instead of welding would I just redraw the sprites as the simulation progresses?
Every time step you would use those two functions to find out where the anchor points are right now.
How you draw the sprite depends entirely on what API you're using, but you will need to figure out how to rotate, scale and position it so that the right points on the sprite are placed at the joint anchor points. I think that is beyond the scope of these forums to be honest.

If the distance joint is a solid one (no stretch or springiness) one way that might be easier is to use two revolute joints and an intermediate body instead. It would be easier to use the position and angle of the intermediate body to calculate where the sprite should be, than to calculate it from the joint anchor points. In that case you could use these functions of b2Body:
GetPosition()
GetAngle()

I don't think you need to involve the user data of anything.
How about if I just drew a black line from the anchor points? By drawing a line would I have redraw the line during the tick method? I am using cocos2d.

Original thread: https://box2d.org/forum/viewtopic.php?t=9284