This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Internationalization and Font size" Watch "Internationalization and Font size" New topic

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 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?
Cindy Glass
"The Hood"

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
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?
Jim Yingst

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
Don't get me started about those stupid light bulbs.
subject: Internationalization and Font size
Similar Threads
Relative OR absolute font size?
Class definition
why do code tags miniaturize the code?
url rewriting