Lab Assignment 6 -- Demo and Writeup Due Oct. 17 in the lab session
CS 5551, Fall Semester, 2013
10 Points
Topics: Painting, Radio Buttons / Combo Boxes, and Window Listeners

Reference: Chapter 6 (painting), Chapter 7 (Radio Buttons / Combo Boxes), and Chapter 10 (Window Listeners)

The assignment: Add the following capabilities to to the previous assignment:

Discussion: There is some useful code to draw ovals (ellipses) in the ScrollDemo2 program. Here is the ScrollDemo2 program file. Other useful code for handling window closing events is in the WindowEventDemo program file. There is another, perhaps better example in the Action Listener tutorial.

To "print the number of rectangles" you might just want to use a WindowAdapter rather than a WindowListener, since you only need to implement the windowClosed() function (to print out the number of rectangles and ovals). Originally this assignment was done in a non-NetBeans environment, in which case "print the number of rectangles" meant to print it to standard output. Using NetBeans, I think the easiest thing to do is to have a label as part of the application and change its text to something like: "There were [a number] rectangles/ovals" at program termination, keeping the application alive for a couple of seconds as in the Window Event Demo program (so the user can briefly see that number recorded before the application exits).

You can use the same "rubber-banding" rectangle of the previous lab assignment for both rectangles and ovals since ovals are drawn by specifying their bounding rectangles.

Extra Enhancement:
1. (1 point) Maintain or implement the filled/unfilled option of the previous program - that is both rectangles and ovals can either be filled or unfilled.

What to turn in: Turn in the following items from the Computer Science Lab Report Format:
1. (1 point) The Basic Information (your name, class, section, TA's name, assignment number, and date) can be on a separate cover sheet or as (highlighted) comments at the top of your main program file.
9. (1 point if done) Document the Extra Credit part of your program if you did it (by coded/hand-written comments and highlighting -- as usual).
11. (4 points) Include the program listings. This listing should show good style, be appropriately commented, have the important/new parts highlighted, and include handwritten explanations if it helps the reader's understanding of the code.
13./14. (5 points) Do a demo of your modified program for the TA that demonstrates that the program works correctly.


Page URL: http://www.d.umn.edu /~ddunham/cs5551f13/assignments/lab6/assignment.html
Page Author: Doug Dunham
Last Modified: Thursday, 10-Oct-2013 16:25:32 CDT
Comments to: ddunham@d.umn.edu