Article View: borland.public.jbuilder.java.api
Article #2503Re: charWidth Question
From: James A. Schulz
Date: Sat, 18 Nov 2000 00:00
Date: Sat, 18 Nov 2000 00:00
41 lines
1552 bytes
1552 bytes
Never mind this question, but I have another:
I have an applet in which I have the following:
g.drawString("pccharWidth =
"+g.getFontMetrics().charWidth('W'),20,100);
g.drawString("pccharHeight = "+g.getFontMetrics().getHeight(),20,120);
when I run this applet in the IDE, I get pccharWidth = 10 and pccharHeight =
18. However, when I run the .jar file in IE5 (on the same machine) I get
pccharWith 10 but pccharHeight = 22!
the font in question is "Monospaced", 16.
What's going on here?
thanks
James
"James A. Schulz" <jaschulz@wiseware.com> wrote in message
news:8v55kg$he62@bornews.inprise.com...
> Given that I am running JB4 and have the following;
>
> import java.awt.Font;
> import java.awt.FontMetrics;
> .
> .
> .
> public void paint(Graphics g){
> int x = getFont().charWidth('W');
> }
>
> Why does the compiler give the Method Not Found error for charWidth?
>
> thanks,
>
> James
>
>
>
Technical Details
Message-ID:
<8v6b4j$1qf1@bornews.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8v55kg$he62@bornews.inprise.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,e95a61705643e9b2 X-Google-Attributes: gid1089d0,public From: "James A. Schulz" <jaschulz@wiseware.com> Subject: Re: charWidth Question Date: 2000/11/18 Message-ID: <8v6b4j$1qf1@bornews.inprise.com> X-Deja-AN: 695129597 References: <8v55kg$he62@bornews.inprise.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Reply-To: "James A. Schulz" <jaschulz@wiseware.com> Newsgroups: borland.public.jbuilder.java.api