Hello,
I need to know how to get get the width of a string without having a
java.awt.Graphi cs around (otherwise i'd just
graphics.getFon tMetrics().stri ngWidth("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
I need to know how to get get the width of a string without having a
java.awt.Graphi cs around (otherwise i'd just
graphics.getFon tMetrics().stri ngWidth("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
Comment