Reference: Chapter 6 (painting), Chapter 7
(Radio Buttons), 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.
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).
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.
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.