4

I using TextFlow object as the graphic node for a CheckBoxTextItem (from controlsFX). If the TextFlow object is longer the width of the tree view, it gets wrapped. How can I stop the wrapping? or set something like an Ellipsis String-- like what you can do with Labels?

The text flow object is made up of Text objects.

melkhaldi
  • 899
  • 2
  • 19
  • 40
  • 1
    What's weird is, I have the exact opposite situation. I want it to wrap to the available width, but it refuses to wrap at all. – Hakanai Nov 04 '17 at 03:47

2 Answers2

6

From the TextFlow documentation:

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.

So, to stop a TextFlow from wrapping:

textFlow.setPrefWidth(Region.USE_COMPUTED_SIZE);
jewelsea
  • 150,031
  • 14
  • 366
  • 406
  • Hi jewelsea, It works better. but I am still getting a text-wrap in certain situations. I might just force clip text so it does go beyond a certain range. – melkhaldi Apr 19 '14 at 15:57
  • 1
    I think it works in all cases if you add `textFlow.setMinWidth(Region.USE_PREF_SIZE);` – negste Oct 17 '17 at 07:14
0

You can wrap a textflow in a scrollpane because scrollpane layout is calculated by its child nodes .

Giovanni Contreras
  • 2,345
  • 1
  • 13
  • 22