How one can adjust minimum width of the JavaFX 8 (8_45) Label control item according to its content? To this very moment I had to adjust size of my GUI components manually, in order to be sure, that their content will be visible no matter what will happen with the size of its parent (eg. HBox, Scene, Stage or whatever), ie.:
Label label = new Label("Foo foo foo");
label.setMinWidth(someMinValue);
Is there a way to make Label or any other JavaFX control item to "listen" its content and adjust its width to it automatically? Thank you in advance.
If you want to make sure your label stays big enough for the text it holds, you probably want to set its minimum size to track its preferred size:
label.setMinWidth(Region.USE_PREF_SIZE);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With