The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

See Java Documentation!!

Posted by Nik on August 01, 2001 at 8:48 AM

Hi, try this
public void init () {
Font theFont;
int count=0, stringwidth, stringheight;
FontMetrics fm;
String str="12345";
theFont = new Font ("Courier", Font.BOLD, 24);
setForeground(Color.blue);
fm = getFontMetrics(theFont);
count = count+1;
stringheight = fm.getHeight();
stringwidth = fm.stringWidth(str);

}


Best regards, Nik




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us