如何在javafx代码中添加Anchor Pane约束? [英] How to add Anchor Pane constrains in javafx code?

查看:657
本文介绍了如何在javafx代码中添加Anchor Pane约束?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道您可以在fxml中添加Anchor Pane包含:'AnchorPane.bottomAnchor =0.0'但是您可以在java代码中设置AnchorPane约束吗?

I know that you can add Anchor Pane contains in fxml like:'AnchorPane.bottomAnchor="0.0"' but can you set AnchorPane constrains in java code?

推荐答案

AnchorPane上有一组静态方法,您可以使用节点和约束来调用它们。

There are a set of static methods on AnchorPane which you call with the node and the constraint.

示例

AnchorPane.setBottomAnchor(button, 0.0);

这篇关于如何在javafx代码中添加Anchor Pane约束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆