Package shapes

Class Shape

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Shape>, Movable
    Direct Known Subclasses:
    Line, Point, SurfaceShape

    public abstract class Shape
    extends java.lang.Object
    implements Movable, java.lang.Cloneable, java.io.Serializable, java.lang.Comparable<Shape>
    Abstract class which all shapes extend. Allows that other elements of application are not depend on all shapes individually but on this class.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.awt.Color color  
      private boolean selected  
      private static long serialVersionUID  
    • Constructor Summary

      Constructors 
      Constructor Description
      Shape()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract boolean containsClick​(int xCoordinate, int yCoordinate)
      Abstract method that must implements all shapes to determine if is selected.
      abstract void draw​(java.awt.Graphics graphics)
      Abstract method that must implements all shapes to draw itself.
      java.awt.Color getColor()  
      boolean isSelected()  
      abstract void selected​(java.awt.Graphics graphics)
      Abstract method that must implements all shapes to select itself.
      void setColor​(java.awt.Color color)  
      void setSelected​(boolean selected)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Comparable

        compareTo
    • Field Detail

      • selected

        private boolean selected
      • color

        private java.awt.Color color
    • Constructor Detail

      • Shape

        public Shape()
    • Method Detail

      • draw

        public abstract void draw​(java.awt.Graphics graphics)
        Abstract method that must implements all shapes to draw itself.
        Parameters:
        graphics -
      • selected

        public abstract void selected​(java.awt.Graphics graphics)
        Abstract method that must implements all shapes to select itself.
        Parameters:
        graphics -
      • containsClick

        public abstract boolean containsClick​(int xCoordinate,
                                              int yCoordinate)
        Abstract method that must implements all shapes to determine if is selected.
        Parameters:
        xCoordinate - Represent x coordinate of user click.
        yCoordinate - Represent y coordinate of user click.
        Returns:
        Represent Boolean that indicate if shape contains click.
      • isSelected

        public boolean isSelected()
      • setSelected

        public void setSelected​(boolean selected)
      • getColor

        public java.awt.Color getColor()
      • setColor

        public void setColor​(java.awt.Color color)