たとえば、setMinSize()
などのコンテナで動作しますか?GridPane
私のプログラムでGridPane
はminを無視していることがわかりました。手動でサイズ変更する際のサイズプロパティ。
FXMLコードは次のとおりです。
<GridPane fx:id="gp" prefHeight="134.0" prefWidth="238.0" xmlns:fx="http://javafx.com/fxml" fx:controller="javafxapplication12.SampleController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
</GridPane>
およびコントローラークラス
public class SampleController implements Initializable {
@FXML
private GridPane gp;
@Override
public void initialize(URL url, ResourceBundle rb) {
gp.setMaxWidth(700);
gp.setMinSize(200, 200);
}
}
ここで何が問題になっていますか?ある種の「ウィンドウ」の最大/最小サイズが必要ですか?