2013-02-26 2 views
8

최대 너비와 높이로 격자 팬을 확장 할 수 있습니까?GridPane을 최대 너비와 높이로 확장하십시오.

<fx:root type="javafx.scene.layout.AnchorPane" xmlns:fx="http://javafx.com/fxml" 
     stylesheets="view/Style.css"> 
    <children> 
     <GridPane xmlns:fx="http://javafx.com/fxml" 
        AnchorPane.topAnchor="0.0" AnchorPane.bottomAnchor="128.0" 
        AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" 
        hgap="10" vgap="10"> 
      <!--anything--> 
     </GridPane> 
    </children> 
</fx:root> 

와 나는 (아래 부분을 제외하고 그래서 전체 화면) 앵커 창에 의해 결정된 한계

답변

13

가의 maxHeight을 설정하려고 격자 창을 확장하고 싶습니다 :

난 다음이 및 GridPane의 maxWidth 프로퍼티. 당신이 fxml 않고 직접 자바 FX를 사용하는 경우 GridPane의

maxHeight="Infinity" maxWidth="Infinity" 

그리고 어린이는

GridPane.hgrow="always" GridPane.vgrow="always" 
+1

고맙습니다.하지만 maxHeight와 maxWidth의 요점은 무엇입니까? 그 부분은 제 신청서에 어떤 변화도주지 않았습니다. – Hassan

5

을 포함해야합니다. 코드는 다음과 같습니다 :

GridPane.setHgrow(childElementOfGridPane, Priority.ALWAYS); 
GridPane.setVgrow(childElementOfGridPane, Priority.ALWAYS); 
관련 문제