🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10806

Re: How to know the size in pixels???

#10806
From: Vincent Nuijten
Date: Thu, 12 Aug 1999 00:00
24 lines
1203 bytes
hi

the following clears your problem:

width = this.getFontMetrics(this.getFont()).stringWidth(str);

greetings
casper

David V�squez Estrada wrote in message <37B18BC5.FDC58523@ucbcba.edu.bo>...
>Hi,
>
>I�m trying to know the size in pixels of a string that will be the text
>of a JLabel.
>At this time I can know the number of characters and the current font
>size, but the result of:   (number of characters * current Font size) is
>bigger than the required.
>
>Any suggestions?
>
>Thanks in advance
>
>David
>
Technical Details
Message-ID: <7oudi8$h8l$1@zonnetje.nl.uu.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37B18BC5.FDC58523@ucbcba.edu.bo>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111d45,db95dab94e8fcb9e
X-Google-Attributes: gid111d45,public
From: "Vincent Nuijten" <info@c-content.nl>
Subject: Re: How to know the size in pixels???
Date: 1999/08/12
Message-ID: <7oudi8$h8l$1@zonnetje.nl.uu.net>
X-Deja-AN: 511824278
References: <37B18BC5.FDC58523@ucbcba.edu.bo>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
X-Complaints-To: abuse@nl.uu.net
X-Trace: zonnetje.nl.uu.net 934459784 17685 212.136.248.44 (12 Aug 1999 12:09:44 GMT)
Organization: UUNET-NL (http://www.nl.uu.net)
NNTP-Posting-Date: 12 Aug 1999 12:09:44 GMT
Newsgroups: borland.public.jbuilder.java.swing