Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Width of a String
Width of a String [message #452540] Mon, 21 March 2005 16:55 Go to next message
Eclipse UserFriend
Originally posted by: Blum_Thomas.nospam.web.de

Hi,
is there any possibility to determine the width of a String (in pixels)
when the font-size is given?
Regards
Thomas Blum

--
Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/m2/
Re: Width of a String [message #452543 is a reply to message #452540] Mon, 21 March 2005 18:28 Go to previous messageGo to next message
Eclipse UserFriend
I found one in draw2d, see FigureUtilities.getTextWidth(String, Font)

Frank

Thomas Blum wrote:
> Hi,
> is there any possibility to determine the width of a String (in pixels)
> when the font-size is given?
> Regards
> Thomas Blum
>
Re: Width of a String [message #452562 is a reply to message #452540] Tue, 22 March 2005 08:20 Go to previous message
Eclipse UserFriend
See
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet93.java?rev=HEAD&a mp;content-type=text/vnd.viewcvs-markup
(you can set the Font on the GC if it's different from the Label's current
font).

Grant

"Thomas Blum" <Blum_Thomas@nospam.web.de> wrote in message
news:opsn0civbm72jlis@thomas...
> Hi,
> is there any possibility to determine the width of a String (in pixels)
> when the font-size is given?
> Regards
> Thomas Blum
>
> --
> Erstellt mit Operas revolution
Previous Topic:Advanced Table Tutorial?
Next Topic:Need to know when the checkbox is clicked
Goto Forum:
  


Current Time: Fri Jul 04 10:35:21 EDT 2025

Powered by FUDForum. Page generated in 0.59680 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top