Lab 4: Finishing and maintaining code

Today you will finishing writing the version control program from last time. At the same time, you will be maintaining it, based on three considerations:

  1. The specification has changed! Now the window needs to have a button at the top and an adjacent text field; when the user puts a number in the textfield and presses the button, the window should jump to the version number specified. If the textfield contains an invalid version number (or something that is not a number), the program should ignore the request (but the program should not crash). Do an svn update to get the new code for the window. The VCWindow interface now contains a method getGoToButton(), but you do not have direct access to the textfield. Instead, the ActionEvent you get when the "go to" button is pressed contains the information of what's in the field. To get the String, use the getActionCommand() method in class ActionEvent.

  2. You have thought more carefully about certain design aspects, including the various agents on the buttons. (Even if you have not thought about these things on your own, at least we have talked about them in class.)

  3. You know more about Java --- you now know (at least a little bit) about abstract classes. You could use them to factor out commonality (for example, among the agent classes).

This does not mean that you must use abstract classes (in fact, you might not feel comfortable using them yet, since we talked about them for all of fifteen minutes yesterday). But it does mean you should at least consider that option in your design.

4. To turn in

Commit your final changes to subversion. You do not need to turn in a hard copy.


Thomas VanDrunen
Last modified: Wed Jan 24 16:01:43 CST 2007