ThislibraryprovidespropertybindingssimilartoQtsignalslotsystem,JavaFx'spropertiesandother.
示例程序:
privateclassModel{valtext=newObservable("count:0")privatevarcount=defincrement(){count+=1text()="count:"+count}}objectExampleextendsSimpleSwingApplication{privatevalmodel=newModeldeftop=newMainFrame{title="Example"contents=newGridPanel(2,1){valbutton=newButton("PressMe!")contents+=buttonvallabel=newLabel{text=observes(model.text,text_=)}contents+=labellistenTo(button)reactions+={caseButtonClicked(_)=>model.increment()}}}}
评论