No.
You can use HTML in the label, but then you must hard code the break tag.
A better approach is to use a JTextArea and turn wrapping on. You can change the background,foreground, font etc. of the text are to make it look like a label.
Note, this answer is outdated as of at least Java 7.
As per @darren's answer, you simply need to wrap the string with <html>
and </html>
tags:
myLabel.setText("<html>"+ myString +"</html>");
You do not need to hard-code any break tags. The text wraps as the component resizes.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…