0
노드가있는 Pane
을 만들면 화면에 렌더링하지 않고 너비와 높이를 어떻게 계산할 수 있습니까?(JavaFX의) 장면에 추가하지 않고 창 크기를 가져 옵니까?
메모리 (메모리)에 문서를 만들어 프린터로 보내려고합니다. 문제는 내가 얼마나 많은 페이지를 계산할 필요가 있다는 것입니다. 문서의 크기를 알아야합니다.
내가 실험하고있어 빠른 예 :
Label testLabel1 = new Label("TEST1");
Label testLabel2 = new Label("TEST no. 2");
GridPane testGl = new GridPane();
testGl.add(testLabel1, 1, 1);
testGl.add(testLabel2, 2, 2);
VBox testVBox = new VBox(testGl);
Pane testPane = new Pane(testVBox);
//I read that this might be required
testPane.applyCss();
testPane.layout();
//Also that a delay is needed for the fx tread to update testPane
// (but shouldn't this all be in the same thread since it is in the same function?
// It doesn't seem to help).
Platform.runLater(()->{
System.out.println(">>> "+ testPane.getBoundsInLocal().getWidth());
});
모든 나는 지금까지 출력이 >>> 0.0
입니다. 개발중인 프로그램에서 "컨테이너"안에 Pane
이 여러 개 있습니다. Pane
. 따라서 변수 testPane
.
감사합니다.
감사합니다. 저는 항상 Scene의 요소가 시각적 구성 요소 (예 : 영화의 '장면')로 간주됩니다. Scene 객체의 기본 사항도 검토해야합니다. 내 다른 직업 전화 그래서 나는 내일 그것을 테스트해야합니다. –