开发者

How to wrap a long text which has no whitespace in it

开发者 https://www.devze.com 2023-01-11 17:14 出处:网络
final jLabel descLabel = new jLabel(); des.setWordWrap(true); des.setWidth(\"200px\"); descLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
final jLabel descLabel = new jLabel();
des.setWordWrap(true);
des.setWidth("200px");
descLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
tableDisplay.setWidget(row, 2, des);

I'm placing the label inside a FlexTable

This is开发者_高级运维 how it looks in the label. It's exceeding beyond the width I have given for the label. Appears odd. I mean to say that the long text without whitespace is not following the width I have given for the label. Tried giving this:

public class Jlabel extends Label{
public  Jlabel () {
 DOM.setStyleAttribute(this.getElement(), "word-wrap", "break-word");
}

wwwwwwwwwr ttttttttttt rrrrrrrrrrrrrrrrr yyyyyyyyyyyyyyyyr rriuoeggn ryyyyyy ryj klrtp;irptiml;rtkroitlrktrpotilr;gkawpeti;lrkgwptjkrotkw;'rtoi4p[tok


Browsers can only break words on whitespace characters. So you need to provide some in your long word.

One option is to insert ­ every 10 characters. This will (should) not display if the word fits into a line.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号