PopUpPositioningDemo.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:javafx-demos 作者:
public Point2D showPopUp(final Node node, final Popup popup){
        final Parent parent = node.getParent();
        final Bounds childBounds = node.getBoundsInParent();

        double x = 0;
        double y = 0;
        if (null != parent) {
            final Bounds parentBounds = parent.localToScene(parent.getBoundsInLocal());
            x = childBounds.getMinX() + parentBounds.getMinX() + parent.getScene().getX()
                    + parent.getScene().getWindow().getX();
            y = childBounds.getMaxY() + parentBounds.getMinY() + parent.getScene().getY()
                    + parent.getScene().getWindow().getY();
        }

        Point2D pd= new Point2D(x, y);
        popup.show(node, x, y);
        return pd;

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号