java - Why GUI not updating in Observer pattern? -
i have observable class notifies observer when string changes. in observer's update method updated string can printed console. gui not updated accordingly. why?
public void update(observable o, object arg) { string s=swimmingcompetition.init().getscoredata().getresults(); system.out.println(s); //this works jtextarea1.settext(s); //this not }
i bet neglecting invoke addobserver()
on observer
, or neglecting invoke both setchanged()
and notifyobservers()
in observable
. complete examples shown here.
Comments
Post a Comment