Text width
From: Oskar Sigvardsson (gingis55_at_yahoo.com)
Date: 02/27/04
- Next message: Jeff Rhines: "Re: Runtime.getRuntime.exec question"
- Previous message: Mark A. Washburn: "Standard Sieve performance"
- Next in thread: Chris: "Re: Text width"
- Reply: Chris: "Re: Text width"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Feb 2004 16:52:39 -0800
Hello,
I need to know how to get get the width of a string without having a
java.awt.Graphics around (otherwise i'd just
graphics.getFontMetrics().stringWidth("Hello I'm a string") )
The thing is that I have I function that returns an Image with the
text, and I want to create the Image inside the function. The size of
the Image is determined by how big the text is, but to get the size of
the text I need to have an Image, and to get the Image I need to know
the size of the text. So I'm in a catch-22 hell and I don't know how
to get out (I suppose I could create a temporary Image and use that
for determining the size and then discard it and create another Image
with the correct size but there has to be a better way.)
Any help appriciated
Oskar Sigvardsson
- Next message: Jeff Rhines: "Re: Runtime.getRuntime.exec question"
- Previous message: Mark A. Washburn: "Standard Sieve performance"
- Next in thread: Chris: "Re: Text width"
- Reply: Chris: "Re: Text width"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|