簡體   English   中英

如何將線綁定到節點? 在JAVAFX中

[英]How to bind line to the node? in JAVAFX

例如,

fLine.setStartX(aNode.getLayoutX());
fLine.setStartY(aNode.getLayoutY());
fLine.endXProperty().bind(bNode.layoutXProperty());
fLine.endYProperty().bind(bNode.layoutYProperty());

我想要,

fLine.setStartX(aNode.getLayoutX());
fLine.setStartY(aNode.getLayoutY());
fLine.endXProperty().bind(bNode.layoutXProperty()+10);
fLine.endYProperty().bind(bNode.layoutYProperty()+10);

我怎樣才能做到這一點?

您可以

fLine.endXProperty().bind(bNode.layoutXProperty().add(10));
fLine.endYProperty().bind(bNode.layoutYProperty().add(10));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM