Control for displaying multiline text?

前端 未结 5 1452
旧巷少年郎
旧巷少年郎 2020-12-29 02:00

I need to display a multiline, read-only text - which control can be used for that? It should only display the text, like a Label does, however Label does not support multil

5条回答
  •  灰色年华
    2020-12-29 02:25

    You can also use Text to appear in multiline, by setting wrappingWidthProperty according to your needs.

    Text text = new Text();
    text.wrappingWidthProperty().set(345);
    

    In this code, I have set max width to 345.0 ,So When the text's size reaches beyond 345 pixels will be wrapped to next Line.

提交回复
热议问题