我收到这样的警告:warning: [static] static method should be qualified by type name, AnchorPane, instead of by an expression
这是我的代码:
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));
}
});
}
发布于 2018-06-04 10:23:07
AnchorPane.getBottomAnchor()
是一种静态方法。静态方法与类关联,而不是实例,因此应该用类名称来调用,而不是通过引用来调用。
尝试
System.out.println(heightProperty().doubleValue()+" "+AnchorPane.getBottomAnchor(p));
https://stackoverflow.com/questions/-100004719
复制相似问题