Package shapes

Class 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 Detail

      • 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.
        Specified by:
        draw in class Shape
        Parameters:
        g -
      • equals

        public boolean equals​(java.lang.Object obj)
        Determine if two circles are equal by center and radius.
        Overrides:
        equals in class java.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 class java.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.
        Specified by:
        selected in class Shape
        Parameters:
        g -
      • containsClick

        public boolean containsClick​(int xCoordinate,
                                     int yCoordinate)
        Determine if circle contains click.
        Specified by:
        containsClick in class Shape
        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 class java.lang.Object
      • fillUpShape

        public void fillUpShape​(java.awt.Graphics g)
        Fill up circle.
        Specified by:
        fillUpShape in class SurfaceShape
        Parameters:
        g -
      • getCenter

        public Point getCenter()
      • setCenter

        public void setCenter​(Point center)
      • getRadius

        public int getRadius()
      • setRadius

        public void setRadius​(int r)