Hi,

I am stumped. With a label and wrapText=true I am not getting wrapped text when I think I should. Consider this scene (code at bottom):

VBox
  - Label, long text, wrapText=true
  - ListView, prefHeight=1000 (too big to fit)

This will not wrap the label text. The VBox gives all room to the listview and keeps the label on a single line. VBox.vgrow does not change this.

Without the prefHeight on the listview I am getting wrapped text. Then, label height is 34 - while its min/pref/max height is all at 17 according to ScenicView.

Why is the label not reporting a pref height of 34?
Why is the vbox sizing the label beyond its max height?

Appreciate any insight because I don't see what's going on.

Rgds
Werner




public class WrapTest extends Application
{
  public static void main(String[] args)
  {
    Application.launch(args);
  }

  @Override
  public void start(Stage primaryStage) throws Exception
  {
    Label label1 = new Label(Strings.repeat("bla ", 50));
    label1.setWrapText(true);

    ListView<String> lv = new ListView<String>();
    lv.setPrefHeight(1000);

    VBox vb = new VBox(label1, lv);
    Scene scene = new Scene(vb, 800, 600);
    primaryStage.setScene(scene);
    primaryStage.show();
  }
}

Reply via email to