Label prefHeight vs wrapText
lehmann at media-interactive.de
Thu Feb 5 16:12:15 UTC 2015
Sorry to dig up this old thread. Just wanted to mention a much simpler
workaround if a label inside a vbox does not wrap its text:
As before the trick is to prevent vbox from reducing the label height
below its pref height to preserve the wrapping - even if other children
of the vbox need to be shrunk.
On 28.05.2014 18:10, Werner Lehmann wrote:
> thanks for the explanation. Feels good to finally understand this ;-)
> And while I created a ticket as per your suggestion...
> [#RT-37309] VBox: vshrink layout hint similar to vgrow
> ...it seems I can use this as a workaround:
>> () -> label1.prefHeight(vbox.getWidth()),
> Maybe something similar could be made available per label boolean
> property. So basically the ability to ask a label to consider wrapping
> when calculating its minHeight... I can imagine that this might have
> made more sense as a default behavior: if people explicitly ask for
> wrapping text, they would probably accept a larger minHeight.
More information about the openjfx-dev