我正在尝试将我的打印方法绑定到 xProperty() (print().bind(scene.xProperty());)
。它运行一次,但是当调用 xProperty 时,我的方法不会再次被调用。我如何让它多次调用。
public DoubleProperty print(){
System.out.println("print");
DoubleProperty dp = new DoubleProperty(){
public void removeListener(ChangeListener cl){}
public void removeListener(InvalidationListener cl){}
public void addListener(ChangeListener cl){}
public void addListener(InvalidationListener cl){}
public double get(){return 10;}
public String getName(){return "";}
public Object getBean(){return new Object();}
public boolean isBound(){return true;}
public void unbind(){}
public void bind(ObservableValue observable){}
public void set(double d){}
};
return dp;
}