Question

Consider the following: a BorderPane with a VBox in the center and a ListView on the left. The ListView has a fixed (preferred) width. In the center VBox there are a bunch of Labels with text. I've chosen for this UI because I want the Labels to resize with the Stage (or thus Scene), so I placed them in the center of a BorderPane. However, this allows the children to take up their preferred size, which for a Label means it grows with its textProperty. This implies the Labels grow too much and extend over the left part of the BorderPane. Adding the left part after the center part (first setCenter then setLeft) or the other way around doesn't make a difference.

What I want is that the Labels automatically scale with the Stage but upon becoming too small for the text to be on one line, wrap the text (for which I use setTextWrap(true)). However, it seems I need to set the Labels max with, but that would prevent them from resizing with the Stage. How can I best fix this?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top