public Region() throws IllegalStateException { if (canvas_width < 0 || canvas_height < 0) { throw new IllegalStateException("The canvas size has not been set appropriately."); } // initialize position values this.left = canvas_width + 1; this.top = canvas_height + 1; this.right = -1; this.bottom = -1; this.image = null; this.color = ColorConverter.RGB.rgb( (int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255)); }