Package Shapes

Class FreeDrawShape

java.lang.Object
Shapes.MyShape
Shapes.FreeDrawShape

public class FreeDrawShape
extends MyShape
shape that consists of points to allow the user to drag any line he wants
Author:
Itay Finci
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private java.awt.Point p1  
    private java.awt.Point p2  
    private java.util.LinkedList<MyLine> vec  

    Fields inherited from class Shapes.MyShape

    color, origin, stroke, target, thickness
  • Constructor Summary

    Constructors 
    Constructor Description
    FreeDrawShape​(java.awt.Point origin, java.awt.Point target, java.awt.Color color, int thickness)
    a constructor to make new freeDrawShape
  • Method Summary

    Modifier and Type Method Description
    void add​(java.awt.Point target)
    add new segment to this shape
    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

    • p1

      private java.awt.Point p1
    • p2

      private java.awt.Point p2
    • vec

      private java.util.LinkedList<MyLine> vec
  • Constructor Details

    • FreeDrawShape

      public FreeDrawShape​(java.awt.Point origin, java.awt.Point target, java.awt.Color color, int thickness)
      a constructor to make new freeDrawShape
      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 void draw​(java.awt.Graphics g)
      Description copied from class: MyShape
      shapes will implement this method to be drawn
      Specified by:
      draw in class MyShape
      Parameters:
      g - the graphics manager
    • add

      public void add​(java.awt.Point target)
      add new segment to this shape
      Parameters:
      target - the point to connect