Package Shapes

Class MyShape

java.lang.Object
Shapes.MyShape
Direct Known Subclasses:
FreeDrawShape, MyBoundedShape, MyLine

public abstract class MyShape
extends java.lang.Object
class that represent the basic attributes of shape
Author:
Itay Finci
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.awt.Color color  
    protected java.awt.Point origin  
    protected java.awt.Stroke stroke  
    protected java.awt.Point target  
    protected int thickness  
  • Constructor Summary

    Constructors 
    Constructor Description
    MyShape​(java.awt.Point origin, java.awt.Point target, java.awt.Color color, int thickness)
    basic constructor that keeps encapsulation
  • Method Summary

    Modifier and Type Method Description
    abstract void draw​(java.awt.Graphics g)
    shapes will implement this method to be drawn

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • origin

      protected java.awt.Point origin
    • target

      protected java.awt.Point target
    • color

      protected java.awt.Color color
    • thickness

      protected int thickness
    • stroke

      protected java.awt.Stroke stroke
  • Constructor Details

    • MyShape

      public MyShape​(java.awt.Point origin, java.awt.Point target, java.awt.Color color, int thickness)
      basic constructor that keeps encapsulation
      Parameters:
      origin - the point the shape is started
      target - the point the shape end
      color - the color of the shape
      thickness - the line thickness
  • Method Details

    • draw

      public abstract void draw​(java.awt.Graphics g)
      shapes will implement this method to be drawn
      Parameters:
      g - the graphics manager