|
||
Bouncing Ball AppletModel-View-Controlleradapted from an example by David Matuszek
This is a simple example of Model-View-Controller uing the
The Model does the work. Whenever it does something that another class might be interested in, it "broadcasts" the fact to all other classes that might be interested. Note that the Model does not need to know or care anything about which other classes, if any, might be interested, so it remains completely independent of those classes. The View is interested in observing
the Model class; it does this by implementing a version of the The Controller in this program doesn't actually have any controls. However, it does set up the GUI, create the Model and the View, and register the View as an observer of the Model. This code is available as a BlueJ project in a zip file. |