i have a jlabel and using netbeans i have bound it to a property on the form.
the problem is how do i refresh the binding values when the property that the label text has been bound to has changed.
this.firePropertyChange works but smells bad… i would like someonething like this.bindingGroup.refresh or this.refresh that will update the labels text
for example
the jLabel.text is bound to form 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()?????
}
Unfortunately if you want to use the Beans Binding API, you’ll have to deal with the smell of
firePropertyChange.However, I don’t see what the problem is? It’s quite a simple change. Change your class to the following:
Check out this article on java.net for more details.