我有垂直 SplitPane
并希望通过单击按钮以编程方式更改内部 AnchorPane
的大小。到目前为止,我已经
@FXML
private void handleToggleBottomAction(ActionEvent event) {
event.getEventType().getName();
if(bottomToggledUp){
bottomToggledUp = false;
//hide bottom pane
apBottomPane.setPrefHeight(15);
apMapPane.setPrefHeight(750);
apBottomPane.requestLayout();
} else {
// view bottom pane
bottomToggledUp=true;
apBottomPane.setPrefHeight(100);
apMapPane.setPrefHeight(650);
apBottomPane.requestLayout();
}
}
但这并没有改变他们?怎么解决这个问题?
最佳答案
使用AnchorPane.setMinSize(double,double);
现在他们将被迫遵守
关于java - 如何根据需要以编程方式更改锚定 Pane 的高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33535201/