これは、親ペインに合わせて子ペインのサイズを変更することに関してたくさんの質問があるので、重複しているように聞こえるかもしれませんが、SplitPaneをAnchorPane親に合わせてサイズを変更する
私をSplitPaneはAnchorPaneの内側に位置しており、これが私の元のコードです:私は幅を大きくするためにウィンドウをドラッグすると
か:
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="792.0" prefWidth="1055.0"
xmlns="http://javafx.com/javafx/null" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="com.judeochalifu.stock_manager.controller.NewSupplierController">
<children>
<SplitPane fx:id="splitPlane" dividerPositions="0.5" layoutX="371.0" layoutY="229.0" prefHeight="792.0" prefWidth="1055.0"orientation="VERTICAL" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" />
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" />
</items>
</SplitPane>
</children>
</AnchorPane>
これはリサイズせずに出力されます高さ、これは私が得るものです:
結果は、ウィンドウの展開、つまりアンカーパネルの幅と高さに応じてサイズを変更するためにSplitPaneが使用されるためです。内部
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"
:答えは属性のみを使用することをお勧めし
JavaFX: FXML: How to make the child to extend its size to fit the parent pane?
JavaFX Panel inside Panel autoresizing
:私はOPは類似した何かをしようとしているこれら二つの質問を見つけたの周り探し
子ペイン。私は運が無ければこれを試しました:これは私のコードが今のようになります:
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="792.0" prefWidth="1055.0"
xmlns="http://javafx.com/javafx/null" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="com.judeochalifu.stock_manager.controller.NewSupplierController">
<children>
<SplitPane fx:id="splitPlane" dividerPositions="0.5" "orientation="VERTICAL"
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0"
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0"
prefWidth="160.0" />
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="100.0"
prefWidth="160.0" />
</items>
</SplitPane>
</children>
</AnchorPane>
私は何が欠けていますか?
内側アンカー枠のprefHeight、prefWidthを削除してみます。 – yamenk