Is there a way to prevent a JavaFX
TextFlow
control or its Text
children nodes to break lines. I want a TextFlow
without line break growing horizontally.
TextFlow textFlow = new TextFlow();
Text text = new Text("A verrrrryyyyy llllooooonnnnggggg Text that shouldn't contain line breaks.");
textFlow.getChildren().add(text);
Setting setWrappingWidth
to a very high value didn't remove line breaks for me.
Any help is appreciated.
To quote the API doc of TextFlow:
The wrapping width of the layout is determined by the region's current width. It can be specified by the application by setting the textflow's preferred width. If no wrapping is desired, the application can either set the preferred with to Double.MAX_VALUE or Region.USE_COMPUTED_SIZE.
I tried this briefly and depending on the Parent container it seems to work as you intended it.