aspose file tools*
The moose likes Java in General and the fly likes Internationalization and Font size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Internationalization and Font size" Watch "Internationalization and Font size" New topic
Author

Internationalization and Font size

Pres Brawner
Ranch Hand

Joined: Jan 18, 2001
Posts: 92
Imagine this. You've got a string of text that needs to be internationalized. You keep the size of the text box in a properties file so it can be modified depending on the language used.
However, you use System.properties to get the font size from the device using your software. If they have font size bigger than your recommended, your text string gets truncated (unless they manually resize).
I have a couple of ideas. What are yours?
Thanks,
Pres
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
You can either change the font size so the text will fit, or change the size of the TextField to fit the font.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Pres Brawner
Ranch Hand

Joined: Jan 18, 2001
Posts: 92
hmmm.
The font size can't be changed. It's user dependant. The problem is the size of the box. The question is, how would YOU go about changing the box size.
Does that help clarify the problem?
Thanks,
Pres
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
I would read this post to learn how to determine the size of the text at run time. Then I would use the setMinimumSize() and setPreferredSize() methods in Component to ensure that my component would be big enough. Exact details will depend on what sort of component you use, what layout manager, etc. One thing that's worth trying - if your outer container is a Window or JInternalFrame, the pack() method usually does a decent job of finding the best size for a component. Good luck.

"I'm not back." - Bill Harding, Twister
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Internationalization and Font size