首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >错误是什么意思?warning: [static] static method should be qualified by type name, AnchorPane, instead of by an expression

错误是什么意思?warning: [static] static method should be qualified by type name, AnchorPane, instead of by an expression
EN

Stack Overflow用户
提问于 2018-06-04 00:53:32
回答 1查看 0关注 0票数 0

我收到这样的警告:warning: [static] static method should be qualified by type name, AnchorPane, instead of by an expression

这是我的代码:

代码语言:txt
复制
public Chart(Vector<String[]> v, final Pane p, final AnchorPane ap){
    super();
    this.v = v;
    p.heightProperty().addListener(new ChangeListener<Number>() {
        public void changed(ObservableValue<? extends Number> ov,
        Number old_val, Number new_val) {
            draw();

            System.out.println(heightProperty().doubleValue()+" "+ap.getBottomAnchor(p));

        }
    });
}
EN

回答 1

Stack Overflow用户

发布于 2018-06-04 10:23:07

AnchorPane.getBottomAnchor()是一种静态方法。静态方法与类关联,而不是实例,因此应该用类名称来调用,而不是通过引用来调用。

尝试

代码语言:javascript
复制
System.out.println(heightProperty().doubleValue()+" "+AnchorPane.getBottomAnchor(p));
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100004719

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档