MVC Widgets - Introduction

Last Updated: May 5, 1996

Note. Eric Lunt, the author, has given me permission to use and modify this. I've changed only the URL's to point to the local copies since Eric no longer has access to the original site. Also note that, while this is a very valuable MVC tutorial, the Java that it describes, especially event modeling is taken from Java 1.0 only. I have redone the code to be compatible with Java 1.1. You can find this new code here. It can only be used with the most up-to-date browsers or with the applet viewer. J Bergin

MVC Widgets Tutorial

Welcome to the MVC Widgets tutorial. The purpose of this tutorial is to introduce you to this particular implementation of the MVC framework for Java's AWT. This framework has been inspired by ParcPlace-Digitalk's VisualWorks product. This tutorial will take you through a number of lessons that introduce the concept of MVC, explain this particular implementation, and provide plenty of (I hope!) well-commented examples.

The com.bdnm.mvc package can be downloaded as a zip file from mvc.zip. You can also download this tutorial and all the examples at tutorial-mvc.zip. Finally, you can download the com.bdnm.awt package (which is used in a couple of the later examples) at (sorry--not available currently).

Throughout the tutorial, I will provide a running commentary over here on the equivalent concepts in the VisualWorks 2.5 product. I will refer to this product as "Smalltalk" throughout the tutorial (sorry VSE users). Most of the examples should also work in version 2.0, but I haven't tested them. I also don't know how they'll translate to other Smalltalk environments.

Lesson Index

Main Lessons:
  1. Model Overview
  2. Text Field with String Model
  3. Text Field with Any Model
  4. List
  5. List Selections
  6. What's Next?
Other Reference:

Example Index

ExampleJava SourceSmalltalk Source
Example 1: An MVCTextField and its model Example1.java Example1.st
Example 2: Two MVCTextFields with the same model Example2.java Example2.st
Example 3: Two MVCTextFields, different applets, same model Example3.java N/A
Example 4: Using an MVCTextField with a float Example4_1.java
Example4_2.java
Example4_3.java
Example4.st
Example 5: Using an MVCTextField with a ValueAdaptor Example5.java Example5.st
Example 6: An MVCList of Strings Example6.java Example6.st
Example 7: An MVCList of Players Example7.java Example7.st
Example 8: MVCList selections Example8.java Example8.st
Example 9: Team browser Example9.java Example9.st


Go back to the tasks page.