I am using an Anchor to display a popup window (Dialog). On this dialog I want to show JSON output, which is stored in a String.
I have tried using label. But it displays the JSON in normal paragraph even though my json string contains \n. I want the output as JSON native look.
What is the best possible way to achieve this in vaadin 14?
Olli Tietäväinen:
If you want to render newline characters, can use the white-space CSS property. Either through CSS or directly in the element’s Style:
Paragraph p = new Paragraph("this text\nhas\nsome line breaks");
p.getElement().getStyle().set("white-space", "pre");
add(p);