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.
This is really more of a CSS question, than a GWT question. setWordWrap()
is typically used to un-set word wrap on a div -- word wrapping (on whitespace) is the default.
What you want to do is add some CSS to the Label that says { word-wrap: break-word; }
More information here.
I used label.setStyleAttribute("whiteSpace", "normal");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With