0

我得到了这个类,但是当我在应用旋转时打印 line.endXProperty().get() 时,属性不会改变值,

¿如何在转换后获得更新的值?

    @Override
    public void start(Stage stage) throws Exception {
        root = new Group();
        stage.setScene(new Scene(root));

        line = new Line();
        line.setStrokeWidth(5.0);
        line.setStroke(Color.BLACK);
        line.setStartX(10.0f);
        line.setStartY(80.0f);
        line.setEndX(10.0f);
        line.setEndY(10.0f);
        System.out.println("line.getEndX()="+line.endXProperty().get());
        rotate = new Rotate(90, 10.0f, 80.0f);
        line.getTransforms().add(rotate);

        System.out.println("line.getEndX()="+line.endXProperty().get());

        root.getChildren().add(line);

        stage.show();
    }
4

1 回答 1

0

我找到了答案:

Point2D transformedEnd = line.localToScene(line.getEndX(), line.getEndY());  
于 2013-10-11T20:41:12.840 回答