有没有“自动换行”? JLabel的财产? [英] Is there a "word wrap" property for JLabel?

查看:116
本文介绍了有没有“自动换行”? JLabel的财产?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JLabel中显示一些文本。基本上我是动态生成该文本,然后我应用一些HTML标签(例如, BR B )来格式化文本。最后,我将这个格式化的文本分配给我的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.

现在我希望我的Jlabel在到达屏幕末尾时自动将文本换行到下一行,就像 Note Wrap中的自动换行功能。

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.

我该怎么做?

推荐答案

如果你将文字换成< html> ...< / html>

更新:
您也应该设置最大尺寸。

UPDATE: You should probably set maximum size, too, then.

这篇关于有没有“自动换行”? JLabel的财产?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆