This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Edward Bloom wrote:So this code works well with Java 1.5 +!
Are you sure? The API says that TextAttribute.TRACKING is since 1.6.
i should to do this with Java 1.4.. but i don't know, how should i do that!
What you really should be doing is upgrading whatever needs upgrading to get off a Java version that was EOL in October 2008. If there's really no way you can do that maybe you could take a look at TextLayout and its getBounds() method, and try incrementing the x offset for each character ... I expect it would be a fair amount of work to get it right though (watch out for integer math).
There are no new questions, but there may be new answers.