Centering n Strings
This is a straightforward generalization…
First, calculate the height of n strings : int height = n*stringHeight + (n - 1)*leading;
The y-position of the first string is once again: int y = (appletHeight - height )/2 + ascent;while the position of each subsequent string is: y += stringHeight + leading;