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

Info iconThis 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:
Background image of page 1

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

View Full DocumentRight 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
Background image of page 2
CSE115 Lab 5 Fall 2009 A) CanvasListener CanvasListener must implement the java.awt.event.MouseListener interface. All five methods must be defined, but only the mouseClicked(
Background image of page 3

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

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

This note was uploaded on 02/13/2011 for the course CSE 115 taught by Professor Decker during the Fall '08 term at SUNY Buffalo.

Page1 / 9

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

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

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