public int stringWidth (String str)

Returns the total advance width for showing the specified String in this Font. The advance is the distance from the leftmost point to the rightmost point on the string's baseline.

Note that the advance of a String is not necessarily the sum of the advances of its characters.

Parameters:
str    the String to be measured

Returns:  the advance width of the specified String in the Font described by this FontMetrics.

Exceptions:
NullPointerException    if str is null.

See also:
bytesWidth(byte[], int, int), charsWidth(char[], int, int), getStringBounds(String, Graphics)