Is there a “word wrap” property for JLabel?
问题 I am displaying some text in a JLabel. Basically I am generating that text dynamically, and then I apply some HTML tags (e.g., BR and B ) to format the text. Finally I assign this formatted text to my JLabel. Now I want my Jlabel to automatically wrap the text to the next line when it reaches the end of screen, like the \"Word Wrap\" feature in Note Pad. How can I do that? 回答1: Should work if you wrap the text in <html>...</html> UPDATE: You should probably set maximum size, too, then. 回答2: A