Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
My label ignores the carriage return
I have an incoming text string that contains a line break ("\r").
When I output it with
System.out.println(myString)
, the carriage return is interpreted.
However, when I set the string as the Label's content, it ignores the carriage return.
How can I force the Label to interpret the carriage/line return (without the XHTML mode) ?
Use CSS:
.v-label {
white-space: pre-wrap;
}
The carriage return character IMO only works in Windows. Other platforms expect the new line character \n
Your solutions works partially :
If the label is in a GridLayout cell, the latter won't expand after the CSS rule.
How can I make the GridLayout fit the pre-wrapped label ?
Thanks
Haven’t encountered that before. Could you add a screenshot and more details about the environment and possibly a test case as well?