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 Pointcenterprivate intradiusprivate static longserialVersionUID
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Circleclone()Create new instance of this circle.intcompareTo(Shape shape)Compare two circles by radius length.booleancontainsClick(int xCoordinate, int yCoordinate)Determine if circle contains click.voiddraw(java.awt.Graphics g)Draw circle.booleanequals(java.lang.Object obj)Determine if two circles are equal by center and radius.voidfillUpShape(java.awt.Graphics g)Fill up circle.PointgetCenter()intgetRadius()voidmoveTo(int xCoordinate, int yCoordinate)Move center of circle to forwarded coordinates.voidselected(java.awt.Graphics g)Select circle.voidsetCenter(Point center)voidsetRadius(int r)java.lang.StringtoString()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:
equalsin 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:
toStringin 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:
containsClickin 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:
clonein classjava.lang.Object
-
fillUpShape
public void fillUpShape(java.awt.Graphics g)
Fill up circle.- Specified by:
fillUpShapein classSurfaceShape- Parameters:
g-
-
getCenter
public Point getCenter()
-
setCenter
public void setCenter(Point center)
-
getRadius
public int getRadius()
-
setRadius
public void setRadius(int r)
-
-