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 ?


Haven’t encountered that before. Could you add a screenshot and more details about the environment and possibly a test case as well?