Java – get the boundary rectangle of drawstring?

Is there any way to get the bounding box it will occupy given the current setting font and string of graphics object?

thank you

Solution

I prefer textlayout #getboundaries(); However, if you already have a graphics context, the string boundary method of fontmetrics is very convenient

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>