Home arrow static arrow Java Programming [Archive] - Height of wrapped text...
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Height of wrapped text...
This topic has 2 replies on 1 page.

Posts:28
Registered: 6/21/04
Height of wrapped text...  
Jun 21, 2004 10:17 AM



 
Hello Java gurus,

Given that you have a text area with a known width, is there an efficient way of calculating
the height of the text in the text area taking into account both line breaks and line wraps?

I know I could write this myself given enough time to read documentation, but I am trying
to save time here :-(

As always...any help is highly appreciated!

Best regards,

Xxodus.
 

Posts:24,517
Registered: 98-02-27
Re: Height of wrapped text...  
Jun 21, 2004 11:40 AM (reply 1 of 2)



 
add the text to the text area and use

textArea.getPreferredSize();
 

Posts:28
Registered: 6/21/04
Re: Height of wrapped text...  
Jun 21, 2004 11:52 AM (reply 2 of 2)



 
It's embarrazing how simple things are when you just know what to look for :-)

Thanks a ton!

BR,

Xxodus!
 
This topic has 2 replies on 1 page.