[6330] in java-interest
Re: FontMetrics and Fonts
daemon@ATHENA.MIT.EDU (Greg Ewing)
Fri Mar 29 13:42:48 1996
Date: Fri, 22 Mar 1996 14:37:20 +1100
Reply-To: Java Interest <JAVA-INTEREST@JAVASOFT.COM>
From: Greg Ewing <grege@OPTIMATION.COM.AU>
To: Multiple recipients of list JAVA-INTEREST
<JAVA-INTEREST@JAVASOFT.COM>
> From NewsGroup_comp-lang-java Thu Mar 21 08:38 EST 1996
> From: NewsGroup_comp-lang-java
> >From: "Lawrence J. Karnowski" <karnowsk@cs.utk.edu>
> Subject: FontMetrics and Fonts
> Date: Tue, 19 Mar 1996 12:44:11 -0500
> Nntp-Posting-Host: tchm06a15.rmt.utk.edu
> Mime-Version: 1.0
> Content-Transfer-Encoding: 7bit
>
> Why is FontMetrics abstract? I glanced at the source code and
> everything looks at least semi-workable. The only problem is that in
> the class declaration it is declared as abstract. Why? I know that the
> methods in the base class are weak but they would work fine for my
> purposes. Maybe I'm going about this one wrong. How is everyone else
> figuring out how much space a certain string in a certain font would
> take up without using FontMetrics? Has anyone tried? Thanks for your
> help.
>
> Lawrence J. Karnowski
Lawrence,
You have to get your FontMetrics object from a component
e.g. FontMetrics fm = aComponent.getFontMetrics();
Safest to do this from within aComponent.paint() because it doesn't exist
until exposed (displayed) the first time.
GREG
grege@optimation.com.au
-----
This message has been forwarded via the JAVA-INTEREST
mailing list. In order to unsubscribe from this list, send a message to
listserv@javasoft.com with the command 'signoff JAVA-INTEREST' in
the message body (not in the subject line).
-----
This message has been forwarded via the JAVA-INTEREST
mailing list. In order to unsubscribe from this list, send a message to
listserv@javasoft.com with the command 'signoff JAVA-INTEREST' in
the message body (not in the subject line).