How do I wrap a very long line of text in a GWT label?

Posted by user323295 on Stack Overflow See other posts from Stack Overflow or by user323295
Published on 2010-04-22T14:01:26Z Indexed on 2010/04/22 14:03 UTC
Read the original article Hit count: 183

Filed under:
|
|
|

This is an extract of my code at the moment:

VerticalPanel mainPanel = new VerticalPanel();
RootPanel.get("messages").add(mainPanel);

HorizontalPanel tempPanel = new HorizontalPanel();
tempPanel.setSize("100px", "200px");

Label content = new Label("AAAveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongtextZZZ");
content.setWidth("50px");
content.setWordWrap(true);

tempPanel.add(content);
mainPanel.add(tempPanel);

The label displays but it does not wrap. If I insert a space it seems that word wrap works, but I guess I want character wrap. Any ideas?

I do not want a horizontal scrollbar.

© Stack Overflow or respective owner

Related posts about gwt

Related posts about textwrapping