tags:

views:

20

answers:

1

Is there a way, given the current set font of the Graphics object and a String to get the bounding box that it would occupy?

Thanks

A: 

I prefer TextLayout#getBounds(); but if you already have a Graphics context, the string bounds methods of FontMetrics are convenient.

trashgod