I'm writing code against the Java Personal Basis Profile in J2ME. I need to measure the width of an AttributedString in pixels.
In Java SE, I'd get an AttributedCharacterIterator from my AttributedString and pass it to FontMetrics#getStringBounds, but in J2ME PBP, FontMetrics doesn't have a getStringBounds
method, or any other method that accepts a CharacterIterator.
What do I do?
You can find the width of the text in pixels.
Now, you will have the width of text in pixels in the variable widthOfText;