如何在GWT标签小部件中格式化文本

时间:2023-01-24 18:17:20

I would like to break a long line of text assigned to the standard Label widget in GWT. I was experimenting with inline <br /> elements but with no success.

我想打破分配给GWT中标准Label小部件的长行文本。我正在尝试使用内联
元素,但没有成功。

Something like this:

像这样的东西:

label = "My very very very long<br />long long text"

2 个解决方案

#1


17  

You need to use the HTML widget, which extends the standard Label widget, and adds support for interpreting HTML tags.

您需要使用扩展标准Label小部件的HTML小部件,并添加对解释HTML标记的支持。

See the JavaDoc.

请参阅JavaDoc。

#2


2  

I would use CSS to style the label to fit a given with and drop the <br/> all together.

我会使用CSS来设置标签的样式以适合给定的并将所有内容放在一起。

#1


17  

You need to use the HTML widget, which extends the standard Label widget, and adds support for interpreting HTML tags.

您需要使用扩展标准Label小部件的HTML小部件,并添加对解释HTML标记的支持。

See the JavaDoc.

请参阅JavaDoc。

#2


2  

I would use CSS to style the label to fit a given with and drop the <br/> all together.

我会使用CSS来设置标签的样式以适合给定的并将所有内容放在一起。