Lab5 - CSE115 Lab 5 Introduction Fall 2009 In this lab you...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE115 Lab 5 Fall 2009 Introduction In this lab you will use the Java you have learned in lecture to write a small program. You will apply what you know about event handling, the realization and association relationships, accessor and mutator methods, and the manipulation of instance variables to complete a small program which lets you draw different shapes using different “shape tools”. In this lab we also include a brief discussion of design patterns. To get a better idea of what the finished product should do, run a lab demo by typing, at the Linux prompt: java -jar /projects/CSE115/Fall2009/FA09-CSE115-Lab5.jar NOTE: This jar file contains no source code. Decompiling this demo is a flagrant violation of the policy on academic integrity and will minimally result in immediate failure in the course. The demo will be shown in recitation. Preparatory tasks 1. Log in 2. Start Eclipse 3. Switch to the CVS Repository Exploring perspective 4. Check out the FA09-CSE115-Lab5 project from the Labs repository 5. Switch to the DrJava perspective In this lab you are given a project with eight skeletal classes in the lab 5 package. You must define the classes so that the program behaves just like the demo. The shapes drawn do not have to have the same color or size, but the shapes should be visible, and the colors unique. Here’s a UML class diagram of t he solution to give you a sense of what objects communicate with each other:
Image of page 1

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

View Full Document Right Arrow Icon
CSE115 Lab 5 Fall 2009 This diagram shows you all of the classes that you must write for this lab. This may seem a little bit overwhelming at first, but it turns out that each class is actually quite small, and there are many similarities between some of the classes. This lab has been broken up into three main sections: 1. CanvasListener and SquareTool (just to get things started) 2. CircleTool and NullTool (adding some variety to our tool box) 3. ToolProxy and ToolButtonListener (changing the tools at runtime) Thoughout all three sections, the BetterDraw constructor will be modified to allow us to test our code as we go. We have already provided you with some of the code since we are in the process of learning about Java graphics in detail. Because of this, all of your modifications to the BetterDraw class should be made within the section of the file that looks like this: In a Java source code file, any text from “//” to the end of the line is ignored by the compiler. This is so that a programmer can insert “comments” into the code. This is one way in which we can document our code, to describe what it is doing. Section 1 CanvasListener and SquareTool
Image of page 2
CSE115 Lab 5 Fall 2009 A) CanvasListener CanvasListener must implement the java.awt.event.MouseListener interface.
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern