如何将line绑定到节点?在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));

最新更新