我使用 TextFlow 对象作为 CheckBoxTextItem(来自 controlFX)的图形节点。
如果 TextFlow 对象长于 TreeView 的宽度,它将被包装。我怎样才能停止包装?或者设置像省略号字符串这样的东西——比如你可以用标签做什么?
文本流对象由文本对象组成。
最佳答案
来自 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.
因此,要阻止 TextFlow 包装:
textFlow.setPrefWidth(Region.USE_COMPUTED_SIZE);
关于javafx-8 - JavaFX : How to stop TextFLow objects from Wrapping,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23165490/