ScalaFX (JavaFX): the contents of the scene does not change when the window is resized

To test this unexpected behavior, I just put it TextAreadirectly in Scene, contained in PrimaryStage: when the application starts, it TextAreaexactly matches the window (as expected).

But the size TextAreadoes not change if I move the borders of the window, which is the problem I'm trying to solve.

See my screenshot

This is my ScalaFX code (which I expect to act exactly like its JavaFX equivalent):

object MyApp extends JFXApp {
  stage = new PrimaryStage {
    title = "My App"
    resizable = true // has no effect
    maxWidth = Double.MaxValue // has no effect
    maxHeight = Double.MaxValue // has no effect

    val outputDisplay = new TextArea {
      resizable = true // has no effect
      maxWidth = Double.MaxValue // has no effect
      maxHeight = Double.MaxValue // has no effect
      hgrow = Priority.Always // has no effect
      vgrow = Priority.Always // has no effect
    }

    scene = new Scene {
      resizable = true // has no effect
      maxWidth = Double.MaxValue // has no effect
      maxHeight = Double.MaxValue // has no effect
      fill = LightGreen

      // add outputDisplay as content
      content = outputDisplay
    }
  }
}
+4
source share
1 answer

TextArea . , BorderPane content.

http://docs.oracle.com/javase/8/javafx/layout-tutorial/builtin_layouts.htm#JFXLY102

UPDATE

ScalaFX, , content root

+1

All Articles