Package shapes
Class Circle
- java.lang.Object
-
- shapes.Shape
-
- shapes.SurfaceShape
-
- shapes.Circle
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Shape>
,Movable
public class Circle extends SurfaceShape
Class that represent circle shape.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private Point
center
private int
radius
private static long
serialVersionUID
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Circle
clone()
Create new instance of this circle.int
compareTo(Shape shape)
Compare two circles by radius length.boolean
containsClick(int xCoordinate, int yCoordinate)
Determine if circle contains click.void
draw(java.awt.Graphics g)
Draw circle.boolean
equals(java.lang.Object obj)
Determine if two circles are equal by center and radius.void
fillUpShape(java.awt.Graphics g)
Fill up circle.Point
getCenter()
int
getRadius()
void
moveTo(int xCoordinate, int yCoordinate)
Move center of circle to forwarded coordinates.void
selected(java.awt.Graphics g)
Select circle.void
setCenter(Point center)
void
setRadius(int r)
java.lang.String
toString()
Print cicle values.-
Methods inherited from class shapes.SurfaceShape
getInteriorColor, setInteriorColor
-
Methods inherited from class shapes.Shape
getColor, isSelected, setColor, setSelected
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
center
private Point center
-
radius
private int radius
-
-
Constructor Detail
-
Circle
public Circle()
-
Circle
public Circle(Point center, int r, java.awt.Color edgeColor, java.awt.Color interiorColor)
-
-
Method Detail
-
draw
public void draw(java.awt.Graphics g)
Draw circle.
-
equals
public boolean equals(java.lang.Object obj)
Determine if two circles are equal by center and radius.- Overrides:
equals
in classjava.lang.Object
-
compareTo
public int compareTo(Shape shape)
Compare two circles by radius length.
-
toString
public java.lang.String toString()
Print cicle values.- Overrides:
toString
in classjava.lang.Object
-
moveTo
public void moveTo(int xCoordinate, int yCoordinate)
Move center of circle to forwarded coordinates.
-
selected
public void selected(java.awt.Graphics g)
Select circle.
-
containsClick
public boolean containsClick(int xCoordinate, int yCoordinate)
Determine if circle contains click.- Specified by:
containsClick
in classShape
- Parameters:
xCoordinate
- Represent x coordinate of user click.yCoordinate
- Represent y coordinate of user click.- Returns:
- Boolean which indicate if circle contains click.
-
clone
public Circle clone()
Create new instance of this circle.- Overrides:
clone
in classjava.lang.Object
-
fillUpShape
public void fillUpShape(java.awt.Graphics g)
Fill up circle.- Specified by:
fillUpShape
in classSurfaceShape
- Parameters:
g
-
-
getCenter
public Point getCenter()
-
setCenter
public void setCenter(Point center)
-
getRadius
public int getRadius()
-
setRadius
public void setRadius(int r)
-
-