In Java, the Swing library implements the Observer/Subscriber-Publisher design pattern to design the way the program responds to events on the GUI (button clicks, etc).
The programmer registers ActionListener
objects (the observers) to a GUI element (the subject/observable/publisher), and these objects get notified by the GUI element when it's state is changed, and do something accordingly. This seems a reasonable way to design a GUI system, and I can't think of any other way a framework could do this.
Is there any other way to design an event-response system in a GUI? Are there any imperative-language frameworks or libraries with a GUI event-response system not designed this way? Does the event-response system in the most common C# GUI library implement event-response issues using Observer, or something else? What about libraries for Python, etc.