Article View: borland.public.jbuilder.java.api
Article #2504Re: charWidth Question
From: Eric Hodges
Date: Sat, 18 Nov 2000 00:00
Date: Sat, 18 Nov 2000 00:00
55 lines
2080 bytes
2080 bytes
Probably because the JDK's are different. Which JDK are you using in
JBuilder?
On a side note, if you're concerned about the differences in character sizes
in a Java program, you're in for a lot of misery. Lots of stuff will vary
from GUI to GUI, from OS to OS, etc. It's best if you can find some other
way to design the application so things like that don't matter.
"James A. Schulz" <jaschulz@wiseware.com> wrote in message
news:8v6b4j$1qf1@bornews.inprise.com...
> 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:
<3a1746e9$1_1@dnews>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8v55kg$he62@bornews.inprise.com> <8v6b4j$1qf1@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: "Eric Hodges" <harmony2@swbell.net> Subject: Re: charWidth Question Date: 2000/11/18 Message-ID: <3a1746e9$1_1@dnews> X-Deja-AN: 695286841 References: <8v55kg$he62@bornews.inprise.com> <8v6b4j$1qf1@bornews.inprise.com> X-Trace: 18 Nov 2000 19:20:09 -0800, 216.62.143.207 X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: borland.public.jbuilder.java.api X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400