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
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
Joined: Jan 18, 2001
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
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.