[英]Android view binding. How implement binding in Basic Activity/Fragment?
[英]Java netbeans binding. how to refresh bindings..?
我有一個jlabel並使用netbeans將其綁定到表單上的屬性。
問題是當標簽文本已綁定到的屬性已更改時,如何刷新綁定值。 this.firePropertyChange可以工作,但聞起來很臭...我想要像this.bindingGroup.refresh或this.refresh這樣的東西,它將更新標簽文本
例如jLabel.text綁定形成someValue
private someClass someThing;
public String getSomeValue(){
return someThing.getSomeThing();
}
//when someMethof is fired the jlabel should update its text value
public void someMethod(){
someThing = someThingElse;
bindingGroup.refresh()?????
}
不幸的是,如果您想使用Beans Binding API,則必須處理firePropertyChange
的味道。
但是,我看不出問題是什么? 這是一個非常簡單的更改。 將您的班級更改為以下內容:
private someClass someThing;
public String getSomeValue(){
return someThing.getSomeThing();
}
//when someMethof is fired the jlabel should update its text value
public void someMethod(){
someClass oldValue = someThing;
someThing = someThingElse;
this.firePropertyChange("someValue", oldValue, someThing);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.