Reputation: 9206
I am going to draw multiline text. Text is limited by width, it wouldn't fit there, so I'd like to how many lines would be there, i.e. I need height of rectangle. I have font variable in Java. How can I do that?
Upvotes: 0
Views: 578
Reputation: 347184
Have a look at Measuring Text, in particular Drawing Multiple Lines of Text
Upvotes: 1
Reputation: 57381
Try this http://java-sl.com/tip_text_height_measuring.html
it works if you reflect the text in JEditorPane/JTextPane
.
Upvotes: 1