CPSC 225, Spring 2010
Lab 8: WebCollage Part 2


This is a continuation of last week's lab. The goal for this lab is to assemble a complete, working web collage program from the parts that team members have written separately.

You will need to write a main() routine for the program, either in a separate class or in one of the classes that you already have. The main routine will have to create some objects, make sure that each part of the program has access to the resources that it needs, open a window, and get things running. Exactly what you need to do depends on the structure of the program.

As one additional requirement, your program should have a way for the user of the program to specify the starting URL for the web crawler. You might need to modify some part of the program in order to do this. A convenient way is to use the method JOptionPane.showInputDialog(null,question) to display a question to the user and get back an answer. The method returns a String containing the user's answer. The string that the method returns should be converted into a URL and added to the blocking queue of document URLs. Note some details: If the user cancels the input dialog, the return value is null. The return value can also be an empty string. Converting a String to a URL can produce a MalformedURLException.

If you have more time, you might consider drawing a randomly colored border around each image, to make the collage look nicer. And one more option: Don't draw small images (in which the height or width is less than some small number), because they are not very likely to be interesting.

When the program is complete, make sure that the final version is committed to the CVS repository. Send me an email with the location of the CVS repository for your team so that I can access the program for grading. Also tell me which part of the program was written by each team member, or tell me that you want to receive a common grade for all team members. I hope to have completed programs to grade over Spring break, but we will decide in class on Friday whether people would like more time to work on the projects.

If your team does not complete a working project and if you would like me to grade your part separately, let me know, and tell me exactly which files I should be looking at. You should have some kind of test routine for testing your part of the project.


Would you like to package your program into an executable jar file, so that you can run it outside of Eclipse? It's easy to do this with Eclipse. Select the "Export..." command (under the "File" menu or in the pop-up menu that you get when you right-click in the Project Explorer). In the first dialog box, select "Runnable Jar File" under "Java", and click "Next". In the next dialog, select the "Launch Configuration" for your program from the list; this should be just the name of the class that contains the main routine for the program. Use the "Browse" button to select an export destination; the file name that you enter should end in ".jar". Then click "Finish" to create the jar file. The jar file should be a double-clickable application on Mac and Windows. On Linux, you might have to right-click it and tell the system to open it with Java (otherwise, Linux might show you the contents of the jar file instead of executing it).


David Eck, for CPSC 225