Search code examples
scalauser-interfacescalafx

ScalaFX multiple childrens


Backend:
I have an observable collection of strings:

val list = new ObservableBuffer[String]

UI:
And I want to put this list after title in VBox:

new VBox {
  children = Seq(
    new Label("My awesome title"),
    list    //Doesn't work
  )
} 

How to make this work?


Solution

  • Solved with:

    new VBox {
      children = Seq(
        new Label("My awesome title"),
        new StackPane{
          children = new ListView[String] {
            items = list
          }
        }
      )
    } 
    

    Is there better solution?