Java Assignment #2, Mouse Boxes

Due: Friday, April 21, 5PM. (But keep in mind there is no school that Friday!)


Combine into a single class, MousedBoxes, the classes from Core Java, TestButton and MouseTest.  The MousedBoxes class should contain a main() function so that I can execute your program merely by compiling MouseBoxes.java, and then doing a "java MouseBoxes".

Program behavior specification:

The program should create a window containing five buttons at the top of the window, labelled "Red", "Blue", "Yellow", "Big", and "Small".  Conceptually, these buttons can be consided to be in two groups, "color" and "size".  Whenever the mouse is clicked in the area below the buttons, a rectangle should be drawn at that point.  The rectangle's size and color shall be determined by the most recently clicked buttons.  Note that clicking on the buttons should not change the appearance of any rectangles already drawn.  Double-clicking on a rectangle shall delete the rectangle.  Clicking and dragging on a rectangle shall move it.
 

Hints:

Be careful how you handle attempts to "drag" a rectangle into the "buttons" area of the window.  There are a couple of ways to handle this, one is to use two panels, instead of one: one to hold the buttons, the other for the rectangles.

Submitting Your Program:

Use the electronic submission system (bunter.cs.emich.edu/~hwmatt/student) to submit your file(s).  You must provide at least one file named MousedBoxes.java.