나는 내 것과 비슷한 문제가있는 사람들을 위해 또 다른 대답을 게시하고 싶다.
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
을 사용하고 있으며 그 너비와 높이가 필요했습니다. 나는 사용자 정의 컨트롤을 작성하므로 자동으로 수행하지 않는 것이 이상한 일 이었으므로 필요한 경우이 작업을 수행하는 방법입니다.
도 Stage
에서 setWidth()
/setHeight()
을 사용할 수있었습니다.
좋아, 감사합니다 :
내 솔루션 크기 조절시 초기화 동안 장식의 크기를 계산하고
Stage
의 크기에 추가하는 것입니다. 그것은 내가 사용하는 것을 생각하거나 사용하지 못하려는 생각이 들지 않는 길입니다. 고마워, 내가 그것을 밖으로 시도하고 어떻게 갔는지 알려주. – Chika고맙습니다. 그러나 제안은 완벽했지만 한 번 더 질문합니다. 나는 장면이나 무대를 깨끗하게 할 수 있어야합니까? 어떻게해야합니까? – Chika
"지우기"단계는 빈 장면을 지정합니다 :'stage.setScene (new Scene());'. 장면을 지우려면, 빈 root :'scene.setRoot (new Group());'을 설정하거나 root의 모든 자식을 제거하십시오 :'scene.getRoot() .getChildren(). clear();' –