aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How can i spacing texts in Java 1.4? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How can i spacing texts in Java 1.4?" Watch "How can i spacing texts in Java 1.4?" New topic
Author

How can i spacing texts in Java 1.4?

Edward Bloom
Greenhorn

Joined: Apr 10, 2012
Posts: 29

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

Joined: May 03, 2008
Posts: 4547
    
    5

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).


luck, db
There are no new questions, but there may be new answers.
Edward Bloom
Greenhorn

Joined: Apr 10, 2012
Posts: 29

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

Joined: May 03, 2008
Posts: 4547
    
    5

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
Greenhorn

Joined: Apr 10, 2012
Posts: 29

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"!
 
 
subject: How can i spacing texts in Java 1.4?