Computer Science 252
Problem Solving with Java
Spring 2016, The College of Saint Rose
Lecture 13: Active Object Wrapup; Java Interfaces
Date: Thursday, March 3, 2016
Agenda
Lecture 13 Assignment
Due at the start of class, Tuesday, March 15.
Please submit answers to these questions
either as a hard copy (typeset or handwritten are OK) or by email to
terescoj AT strose.edu by the start of class. Please use a clear subject line
when submitting by email (e.g., CSC 252 Lecture
13 Assignment, Mary Smith). We will discuss these
questions at the start of class, so no late submissions are
accepted.
You do not need to write working Java code (i.e., in a BlueJ project)
for these.
- Which operations must be supported by an Objectdraw object in
order for it to be draggable? (3 points)
- Write a Java interface called Draggable that includes those
needed methods. (3 points)
- Suppose your WindowController class has an instance
variable of type Draggable and its begin method assigns that
variable to refer to some object that implements the Draggable
interface. Write the onMousePress, onMouseDrag, and
onMouseRelease methods to support dragging of that object.
List any additional instance variables you'll need. (6 points)
Terminology
- interfaces
- object-oriented design
- public interface
Examples