简体   繁体   中英

How to change programatically height of Anchor Pane on demand?

I have vertical SplitPane and want to change size of inner AnchorPane s programatically by clicking on the button. So far, I have

@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();
    }
}

But this doesn't change them? How to solve this?

use AnchorPane.setMinSize(double,double);

now they will be force to comply

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM