How do I calculate the width of a node label

I want to paint a gradient roundrectangle color behind a node label. How do I figure out the width to use so the color goes totally from left to right.

Thanks in advance

I assume you are using the class in Demo1.

You just need to change the points that are passed to the GradientPaint constructor.