Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Width of a String
Width of a String [message #452540] Mon, 21 March 2005 21: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 23:28 Go to previous messageGo to next message
Frank Sauer is currently offline Frank SauerFriend
Messages: 18
Registered: July 2009
Junior Member
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 13:20 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
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: Tue Oct 22 08:16:05 GMT 2019

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

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

Back to the top