Article View: borland.public.jbuilder.java.swing
Article #10719Re: How to know the size in pixels???
From: nlaan
Date: Fri, 13 Aug 1999 00:00
Date: Fri, 13 Aug 1999 00:00
23 lines
1130 bytes
1130 bytes
Sorry, my mistake the correct method is used as followed:
public void paint(Graphics g)
{
FontMetrics fm = g.getFontMetrics();
int width = fm.stringWidth("Hello World");
int height = fm.getHeight();
}
>> FontMetrics fm = new FontMetrics(Font f);
>
>The class FontMetrics is an abstract class; cannot be instantiated.
----------------------------------------------------------------------------
nathan laan 341 Avadh Bhatia Physics Building
University of Alberta Edmonton, Alberta, Canada
nlaan@ualberta.ca (780)492-5289
Technical Details
Message-ID:
<7p1peb$ijd1@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37B18BC5.FDC58523@ucbcba.edu.bo> <7ovhp2$g7u11@forums.borland.com> <37B43577.DF127B44@ucbcba.edu.bo>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,db95dab94e8fcb9e X-Google-Attributes: gid111d45,public From: <nlaan> Subject: Re: How to know the size in pixels??? Date: 1999/08/13 Message-ID: <7p1peb$ijd1@forums.borland.com> X-Deja-AN: 512357660 References: <37B18BC5.FDC58523@ucbcba.edu.bo> <7ovhp2$g7u11@forums.borland.com> <37B43577.DF127B44@ucbcba.edu.bo> Organization: Another Netscape Collabra Server User X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Newsgroups: borland.public.jbuilder.java.swing