tags:

views:

2537

answers:

2

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.

Something like this:

label = "My very very very long<br />long long text"
+2  A: 

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

See the JavaDoc.

jgindin
I would just add that when using the HTML widget you should use the setHTML() method as the setText() method will just accept the string as text
Ittai
+1  A: 

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

smerten
You wrote <br> literally, and so it interprets it as a linebreak. Edit it to <br%gt;
Steve Armstrong
The HTML widget is smart enough to know that <br /> is a HTML element and creates a correct output.
Drejc
By the way CSS will not work in my case as I want to split the text at a exact location.
Drejc