I want to draw a string. at first, I get the string bounds using getStringBounds:
getStringBounds(String, FontRenderContext)
and then, I use DrawString to draw the string. I do not know what the returned vales of getStringBounds (“x” and “y”) are.
Can anybody please help me?
Thanks,
Shadi.
With most Graphics methods you specify the top/left location for the drawing. For example
However, when you draw text you specify the bottom/left location for the drawing. So in your case you would use:
In general terms I guess you would use the absolute value of the Y value in the drawString() method.