私と同じような問題を抱えている可能性のある人のために、別の回答を投稿したかっただけです。
http://docs.oracle.com/javase/8/javafx/api/javafx/scene/Scene.html
setWidth()
またははなくsetHeight()
、プロパティはReadOnly
ですが、
Constructors
Scene(Parent root)
Creates a Scene for a specific root Node.
Scene(Parent root, double width, double height)
Creates a Scene for a specific root Node with a specific size.
Scene(Parent root, double width, double height, boolean depthBuffer)
Constructs a scene consisting of a root, with a dimension of width and height, and specifies whether a depth buffer is created for this scene.
Scene(Parent root, double width, double height, boolean depthBuffer, SceneAntialiasing antiAliasing)
Constructs a scene consisting of a root, with a dimension of width and height, specifies whether a depth buffer is created for this scene and specifies whether scene anti-aliasing is requested.
Scene(Parent root, double width, double height, Paint fill)
Creates a Scene for a specific root Node with a specific size and fill.
Scene(Parent root, Paint fill)
Creates a Scene for a specific root Node with a fill.
ご覧のとおり、必要に応じて高さと幅を設定できます。
私にとっては、SceneBuilder
あなたが行っていたと説明したように、私は を使用しており、その幅と高さが必要でした。カスタム コントロールを作成しているので、自動的に行われないのがおかしいので、必要に応じて行う方法を次に示します。
setWidth()
/ setHeight()
fromも使用できたはずStage
です。