Class Circle

java.lang.Object
  extended by DrawableShape
      extended by Circle

public class Circle
extends DrawableShape

A circle that can be manipulated and drawn.

Version:
Sp 2015
Author:
Joel Ross, adapted from Michael Kolling and David J. Barnes

Constructor Summary
Circle()
          Creates a new Circle object with default location, radius, and color.
 
Method Summary
 void bringToFront()
          Brings the shape to the "front" of the drawing (in front of other shapes)
protected  boolean contains(int x, int y)
          Returns whether the shape contains the given point
protected  void draw(java.awt.Graphics2D g2d)
           
 java.lang.String getColorName()
          Returns the circle's current color (as a String).
 int getRadius()
          Returns the circle's current radius
 int getXPosition()
          Returns the circle's current x position
 int getYPosition()
          Returns the circle's current y position
 boolean isFilled()
          Returns whether the circle is filled or not
 void moveHorizontal(int distance)
          Move the circle horizontally the specified number of pixels.
 void moveVertical(int distance)
          Move the circle vertically the specified number of pixels.
 void removeSelfFromCanvas()
          Removes the shape from the canvas
 void sendToBack()
          Sends the shape to the "back" of the drawing (behind other shapes)
 void setColorByName(java.lang.String newColor)
          Set the circle's color to the given value.
 void setFilled(boolean newFilled)
          Sets whether the circle should be filled; can either be true or false
 void setRadius(int newRadius)
          Sets the circle's radius to the given value
 void setXPosition(int newX)
          Sets the circle's x position to the given value
 void setYPosition(int newY)
          Sets the circle's y position to the given value
 
Methods inherited from class
addSelfToCanvas, getColorFromString, redraw
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Circle

public Circle()
Creates a new Circle object with default location, radius, and color.

Method Detail

bringToFront

public void bringToFront()
Brings the shape to the "front" of the drawing (in front of other shapes)

Overrides:
bringToFront in class DrawableShape

contains

protected boolean contains(int x,
                           int y)
Description copied from class: DrawableShape
Returns whether the shape contains the given point

Specified by:
contains in class DrawableShape

draw

protected void draw(java.awt.Graphics2D g2d)
Specified by:
draw in class DrawableShape

getColorName

public java.lang.String getColorName()
Returns the circle's current color (as a String). Can either be: "red", "green", "blue", "cyan", "magenta", "yellow", "pink", "gray", "black", "white"


getRadius

public int getRadius()
Returns the circle's current radius


getXPosition

public int getXPosition()
Returns the circle's current x position


getYPosition

public int getYPosition()
Returns the circle's current y position


isFilled

public boolean isFilled()
Returns whether the circle is filled or not


moveHorizontal

public void moveHorizontal(int distance)
Move the circle horizontally the specified number of pixels.


moveVertical

public void moveVertical(int distance)
Move the circle vertically the specified number of pixels.


removeSelfFromCanvas

public void removeSelfFromCanvas()
Removes the shape from the canvas

Overrides:
removeSelfFromCanvas in class DrawableShape

sendToBack

public void sendToBack()
Sends the shape to the "back" of the drawing (behind other shapes)

Overrides:
sendToBack in class DrawableShape

setColorByName

public void setColorByName(java.lang.String newColor)
Set the circle's color to the given value. Can either be: "red", "green", "blue", "cyan", "magenta", "yellow", "pink", "gray", "black", "white"


setFilled

public void setFilled(boolean newFilled)
Sets whether the circle should be filled; can either be true or false


setRadius

public void setRadius(int newRadius)
Sets the circle's radius to the given value


setXPosition

public void setXPosition(int newX)
Sets the circle's x position to the given value


setYPosition

public void setYPosition(int newY)
Sets the circle's y position to the given value