/** * A class to describe the location of a mouse click in the window * (Complete) */ public class MouseClickLocation { /** constants to describe the different areas of the window */ public static final int RED = 1; public static final int YELLOW = 2; public static final int GREEN = 3; public static final int ANIMATE = 4; public static final int INACTIVE_AREA = 5; /** The area the click belongs to */ public int area; // Red button, Yellow button, Green button, // or other (inactive area) /** * Construct a MouseClickLocation given an area */ public MouseClickLocation(int area) { this.area = area; } /** * Print the content of this MouseClickLocation (useful for debugging) */ public String toString() { switch(this.area) { case RED: return "Red"; case YELLOW: return "Yellow"; case GREEN: return "Green"; case ANIMATE: return "Animate"; case INACTIVE_AREA: return "Inactive area"; default: throw new Error("problem with toString in MouseClickLocation: area="+this.area); } } }