【问题标题】:API version AnchorPane.topAnchor FXML attributes?API 版本 AnchorPane.topAnchor FXML 属性?
【发布时间】:2014-02-12 17:45:53
【问题描述】:

我正在尝试找出与 FXML AnchorPane.topAnchor(以及底部、右侧、左侧锚点)属性等效的 JavaFX API 调用。通常,FXML 属性似乎是对象上的属性,但似乎没有 AnchorPane 类型属性或任何其他返回此类对象的属性。

例如,如果我有以下 FXML

<BorderPane fx:id="borderPane" AnchorPane.bottomAnchor="4.0"
    AnchorPane.leftAnchor="4.0" 
    AnchorPane.rightAnchor="4.0"
    AnchorPane.topAnchor="30.0"> .... more FXML here

设置锚窗格锚点的相关 Java API 调用是什么?

例如

BorderPane borderPane = new BorderPane();
//
// What method calls on borderPane would set the anchors?
//

感谢任何指点。

  • chooks

【问题讨论】:

  • AnchorPane documentation 会在 Anchor Constraints 部分告诉您如何执行此操作。

标签: javafx-2 fxml javafx-8


【解决方案1】:
AnchorPane.setLeftAnchor(borderPane, 4.0); 

Introduction to FXML, static properties section.

【讨论】:

  • 谢谢 - 我不记得在阅读文档时看到过文档中的某个特定部分。
猜你喜欢
  • 2016-05-14
  • 1970-01-01
  • 1970-01-01
  • 2019-07-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-26
相关资源
最近更新 更多