Program 11

Advanced Programming/Practicum
15-200


Introduction This programming assignment is designed to exercise your skills in writing the View and Controller parts of GUIs written in the MVC pattern. Instead of introducing a new model, we will use the Photomosaic model that we wrote in Programming Assignment #5. If you did not fully solve this problem yourself, then you can download and use my solution for the model.

You will replace the textual view that is driving the model by a graphical one, containing buttons, text fields, etc. This View class will get controls from the Controller class and then position them in some reasonable way. The code for these controls, written in the Controller class itself, will communicate with the Model class.

There are no executables for this assignment, because I want everyone to design their view without being influenced by what mine looks like. You should try to design a GUI that is easy to use; this is harder than you might think: there are many small decisions that can have a large effect on usability.

Use either your or my solution to Programming Assignment #5 as a start folder. Grab any simple Application, View, and Controller class that we have discussed, put in them in the program folder and then delete/adapt the code they contain to work for the photomosaic Model.

Put your project folder in a folder whose name combines your names (when programming in pairs) and the program number (e.g., pattis-stehlik-11). Then zip this folder and dropoff that single zip file. If you are programming in a pair you should submit only one project: either partner can submit it.


Details To simplify things a bit, you will need to write a GUI that performs only the following tasks:
  • select the metric
  • select the filter
  • reset the picture database
  • load more pictures into the database (includes two arguments: width and height)
  • load the picture to render
  • render the picture (includes three arguments: sample width, maximum reuse, and minimum reuse distance)
  • diplay messages returned from the model
For this assignment, you do not need to have the GUI control displaying the picture database, shifting the picture database, or sorting the picture database.

Don't be over-elaborate in your design. Implement something simple first; once you have the simple GUI working, you can improve its appearance/operation as time permits. The use of a JFrame, JPanels (along with layout managers) for layouts, and the controller-components themselves do not need to go beyond what we covered in the three lectures on this material. If you want to do something fancier you can ask questions on the course bboard, but as I said above, get something simple working first.

I'm going to restrain myself from giving you lots of instruction on how to go about writing this program: I don't want everybody's program to look like mine (which is functional, but no great beauty either). So, do what your head/heart says is best, but don't hesitate to ask questions. I'd very much like the last assignment of the semester to generate plenty of high-level dialogue on the course bboard.

One issue that you must deal with, because you are not supposed to change the model, is how some controls can "store" their information so that when other controls are activated, they can access this information. Typically, it is the Controller class that supports this aspect of the controls by storing instance variables representing the values of activated controls. Methods attached to controls can share information via these instance variables (yes, even if they are in anonymous classes in the Controller class). One can solve this problem in many ways, some less/more general than others. You can also use my RadioButtonPanel (see the download for the Controller lecture) if you find it useful. You may not prompt the user for any information (this means no pop-up GUI prompting the user either). All information should be entered via the GUI controls that we covered (e.g., JButton, JTextField, and the like). The console can still be used for debugging purposes, but no useful information should be displayed or entered there.

Again, do something imple and straightforward. The CAs and I will be happy to answer questions to help you get your code working (for high-level ones, use the bboard); reading Javadoc is useful too. Try to use GUI controls that nicely match the kind of information that you need to communicate to the model.