SE450: Observer: Cyclic Dependencies [15/28] |
Example of a GUI element (a slider) which controls a program
variable x
.
Program creates Slider
.
Slider
controls program.
Observer reverse the dependency of Slider on program.
Program can use slider code, but slider decides when to call (back) to the client!
javax.swing.JSlider
javax.swing.event.ChangeListener