Lab 7: Graphical User Interfaces: Mouse interaction, JPanels etc.

Develop a Java program with the user interface displayed here. The user interacts with the user interface by entering desired dimensions in the two textfields. The user then clicks the Draw button, and finally clicks on the lower blue panel. Your software then draws a RED rectangle with the user specified dimensions at the point where the user clicked the lower panel. The user has to go through this process for each rectangle. That is, one click on the DRAW button only allows one rectangle to be drawn. Clicking on the EXIT button terminates the program.

Once the above task is completed, add a menu bar to the Frame that can be used to save the rectangles to a file using an ObjectStream. The menu can also be used to open a file for reading.
Here is a partial solution.