开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜