如何将行绑定到节点?在JAVAFX

时间:2014-08-21 04:32:53

标签: java javafx line bind

例如,

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);

我该怎么做?

1 个答案:

答案 0 :(得分:2)

你可以

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