Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i spacing texts in Java 1.4?

 
Edward Bloom
Ranch Hand
Posts: 34
Eclipse IDE Fedora Firefox Browser
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear forumers!

This is my code:


At the Problem comment you could see the reason why i opened this topic. So this code works well with Java 1.5 +!
Without that rows the result:

https://dl.dropboxusercontent.com/u/827503/test-withoutrows.png

And this is what i need (result with that rows):

https://dl.dropboxusercontent.com/u/827503/test-withrows.png

At my workplace we have to use IBM Rational Application Developer V6.0, JDK 1.4.. well i should to do this with Java 1.4.. but i don't know, how should i do that!

Does someone have any idea how to change this code?
Thank you in advance for any help you can provide.
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Edward Bloom
Ranch Hand
Posts: 34
Eclipse IDE Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Darryl Bruke!

Thank you your post!
I tried find any way, but i don't know how could i increment the x offset.. witch class, method i should to use? Could you help me about that please?



 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I wasn't clear enough. Imeant that maye you can use a separate TextLayout for each character and add space between them.
 
Edward Bloom
Ranch Hand
Posts: 34
Eclipse IDE Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Darryl!

Now i see what did you want to say! Sorry, my English is so creepy.
I am rookie with the java platform, therefore i didn't know how could i use the TextLayout, but(!) you gave me an idea!



It looks like what i want, so this solution enough to me! Thank you so much your comments, those was the "beginner shove"!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic