spec - CSE 143, Winter 2010 Programming Assignment #1:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 of 3 CSE 143, Winter 2010 Programming Assignment #1: Rectangle-Rama (20 points) Due Thursday, January 14, 2010, 11:30 PM thanks to Mike Clancy of UC Berkeley for the original idea of this nifty assignment! This program focuses on using the ArrayList collection class and basic object-oriented programming. Turn in a file named RectangleManager.java online using the turnin link on the Homework section of the course web site. You will also need the support files DrawingPanel.java , Rectangle.java , and RectangleMain.java from the Homework section of the course web site; place these in the same folder as your program or project. (If you use Eclipse, you may need to put these files in the src/ subdirectory of your project if such a subdirectory exists.) You should not modify the provided files. The code you submit must work properly with their unmodified versions. Program Description: In this assignment you will write the logic for a graphical program that allows the user to click on rectangles. The graphical part of the code has already been written for you; your code does not need to directly draw any graphics. The main client program you should run is the provided RectangleMain class. When it runs, it will create a graphical window on the screen; this is an object of type DrawingPanel . The panel will display a list of rectangles. Each rectangle is represented as an object of the provided class Rectangle . Each rectangle's position, size, and color are randomly generated by RectangleMain . The overall list of rectangles should be stored and maintained by your code in the RectangleManager class you will write. In the screenshot to the right, notice that some rectangles overlap and occupy some of the same (x, y) pixels in the window. In such a case, the rectangle created later is "on top" of prior rectangles and may partially cover them on the screen. You should think of the overall list of rectangles as having an ordering, where rectangles stored earlier in the list are closer to the "bottom" and ones stored later in the list are closer to the "top". This is sometimes called a 3-dimensional ordering or z-ordering . The graphical user interface ("GUI") displays the rectangles and allows the user to click on them. Depending on the kind of click, one of four different actions occurs: If the user clicks the left mouse button while the mouse cursor points at a rectangle, that rectangle is moved to the very top of the z-ordering (the end of the list of rectangles). If the user clicks the left mouse button while holding down the Shift key , while the mouse cursor is pointing at a rectangle, that rectangle is moved to the very bottom of the z-ordering (moved to the start of the list of rectangles). If the user clicks the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/04/2011 for the course CSE 143 taught by Professor Sr during the Spring '08 term at University of Washington.

Page1 / 3

spec - CSE 143, Winter 2010 Programming Assignment #1:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online