How do we changeline in a label?

我的梦境 提交于 2019-12-01 13:01:34

Swing does not uses classical line breaks. Instead, for a reason I never fully understood, it uses HTML 3.2. As a consequence, to have your text correctly displayed, yopu have to rely upon HTML content :

String str= "<html>First line<br>Second line</html>"

However, if you really want to, there are other possibilities ...

Use this string

String str= "<html>First line<br>Second line</html>"
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!