如何在javafx中应用轮换之前获取更新的位置?

时间:2013-10-11 13:52:50

标签: rotation javafx-2 transformation

我得到了这个类但是当我在应用rotatios时打印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();
    }

1 个答案:

答案 0 :(得分:0)

我找到了答案:

Point2D transformedEnd = line.localToScene(line.getEndX(), line.getEndY());