We help IT Professionals succeed at work.

Font Size verus TextField Bounds

mag062397 asked
Last Modified: 2013-12-03
I always seem to have to edit, compile, run, edit, compile, run, etc...
when trying to get the TextField box to not cut off the text in it.

Is there any determinant way to set the bounds (height) of a TextField so that
the text that gets displayed in it doesn't get cut off.

I also need it to be platform and resolution independent.

I have tried three platforms:  Windows95, Linux (X), Solaris (CDE).
Windows handles it the best; whereis Solaris the worst.

Watch Question

Is the problem determining what height to set the TextField to, or getting the TextField to conform to the height you know it needs to be?


Setting the TextField height so that it is large enough
to display the font, yet not too large.

That is, does there exist a constant, ?, such that
textField.setBounds(x, y, w, fontSize+?) is large enough
to display the font correctly and that ? is the smallest
constant that exists.

The answer probably depends on the font and/or fontsize; because
I tried setting the height to 25, font family to "TimesRoman" and
it displayed correctly for sizes 1-8 and 10 but not 9.  Strange!?

Unlock this solution and get a sample of our free trial.
(No credit card required)


Yes, I'll do that -- Thanks!
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!



Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)
