Class Circle
java.lang.Object
Circle
A circle that can be manipulated and that draws itself on a canvas.
- Version:
- 2016.02.29
- Author:
- Michael Kölling and David J. Barnes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeColor(String newColor) Change the color.voidchangeSize(int newDiameter) Change the size to the new size (in pixels).voidMake this circle invisible.voidMake this circle visible.voidmoveDown()Move the circle a few pixels down.voidMoves the circle farther to the right than normal.voidmoveHorizontal(int distance) Move the circle horizontally by 'distance' pixels.voidmoveLeft()Move the circle a few pixels to the left.voidMove the circle a few pixels to the right.voidmoveUp()Move the circle a few pixels up.voidmoveVertical(int distance) Move the circle vertically by 'distance' pixels.voidslowMoveHorizontal(int distance) Slowly move the circle horizontally by 'distance' pixels.voidslowMoveVertical(int distance) Slowly move the circle vertically by 'distance' pixels.
-
Constructor Details
-
Circle
public Circle()Create a new circle at default position with default color. This is a constructor. It should give values to every field in the class. -
Circle
public Circle(int initialSize) Here's a constructor that takes a parameter, and uses that value to set up the initial size. -
Circle
public Circle(int x, int y) Here's a constructor that takes initial x and y positions.
-
-
Method Details
-
makeVisible
public void makeVisible()Make this circle visible. If it was already visible, do nothing. -
makeInvisible
public void makeInvisible()Make this circle invisible. If it was already invisible, do nothing. -
moveRight
public void moveRight()Move the circle a few pixels to the right. -
moveFartherRight
public void moveFartherRight()Moves the circle farther to the right than normal. -
moveLeft
public void moveLeft()Move the circle a few pixels to the left. -
moveUp
public void moveUp()Move the circle a few pixels up. -
moveDown
public void moveDown()Move the circle a few pixels down. -
moveHorizontal
public void moveHorizontal(int distance) Move the circle horizontally by 'distance' pixels. -
moveVertical
public void moveVertical(int distance) Move the circle vertically by 'distance' pixels. -
slowMoveHorizontal
public void slowMoveHorizontal(int distance) Slowly move the circle horizontally by 'distance' pixels. -
slowMoveVertical
public void slowMoveVertical(int distance) Slowly move the circle vertically by 'distance' pixels. -
changeSize
public void changeSize(int newDiameter) Change the size to the new size (in pixels). Size must be >= 0. -
changeColor
Change the color. Valid colors are "red", "yellow", "blue", "green", "magenta" and "black".
-