Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Height of a JLabel

843804Nov 19 2004 — edited Nov 19 2004
Hi,

I have a JLabel that shows a little html text. I put it into a column, and it wraps its lines using word wrapping (This is good). Now once its wrapped its lines, I want to find its height.

getPreferredSize gives you the height of an unwrapped JLabel... I tried another approach, and that was dividing the preferred height by the column width. This is not accurate, due to long words near a line break.

How do I find the height of a line-wrapped JLabel?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 17 2004
Added on Nov 19 2004
4 comments
396 views