Basic HTML version of Foils prepared 13 July 98

Foil 13 The stringWidth Method

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

The java.awt.FontMetrics.stringWidth Method
1 To determine the width of the string s in the current font: FontMetrics fm = g.getFontMetrics(); int stringWidth = fm.stringWidth( s ); where g is a Graphics object
2 To determine the string height, simply add the ascent and descent of the current font

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