Flyout.java 文件源码

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

项目:tidbit 作者:
/**
 * Constructs a new {@code Flyout} using the specified "anchor"
 * as the location from which the specified "contents" will 
 * fly out.
 * 
 * @param anchor        Node used to define the start point of the flyout animation
 * @param contents      Node containing the "control" to fly out
 */
public Flyout(Node anchor, Node contents) {
    this.anchor = anchor;
    this.flyoutContents = contents;
    userNodeContainer = new Pane();

    getChildren().addListener((Change<? extends Node> c) -> {
        if(getChildren().size() > 1) {
            throw new IllegalStateException("May only add one child to a Flyout");
        }
    });

    layoutBoundsProperty().addListener((v, o, n) -> {
        if(getChildren().size() < 1) return;

        if(getChildren().size() > 1) {
            throw new IllegalStateException("May only add one child to a Flyout");
        }
    });

    getChildren().add(anchor);

    popup = new Stage();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号