Basic HTML version of Foils prepared 13 July 98

Foil 16 Centering Two Strings

From Java Academy II:Intermediate Java NPAC/ECS Java Academy -- February to April 98. by Tom Scavo

The FontMetricsTest3 Applet
1 First, calculate the height of both strings: int leading = fm.getLeading(); int height = 2*stringHeight + leading;
2 Now calculate the position of the first string: int y = (appletHeight - height )/2 + ascent; where x is computed as before
3 The y-position of the second string is simply: y += stringHeight + leading;

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998