为了检查这种意外行为,我直接将一个
TextArea
放入PrimaryStage
包含的Scene
中:在启动应用程序时,TextArea
正好适合窗口(如预期所示)。
但是,如果我移动窗口的边框,TextArea
的大小不会改变,这就是我试图解决的问题。
请看我的截图
这是我的ScalaFX代码(我希望它的行为与JavaFX的等效代码完全相同):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
}
}
}
TextArea
填充了场景。 - James_D