Package Shapes

Class MyBoundedShape

java.lang.Object
Shapes.MyShape
Shapes.MyBoundedShape
Direct Known Subclasses:
MyOval, MyRectangle, MyRoundedRectangle

public abstract class MyBoundedShape
extends MyShape
represent shapes that have area
Author:
Itay Finci
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private boolean filled  

    Fields inherited from class Shapes.MyShape

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

    Constructors 
    Constructor Description
    MyBoundedShape​(java.awt.Point origin, java.awt.Point target, java.awt.Color color, boolean filled, int thickness)
    makes new compound shape
  • Method Summary

    Modifier and Type Method Description
    protected int calculateHeight()  
    protected int calculateWidth()  
    protected java.awt.Point findStart()
    finds the point to start drawing from to allow drawing shapes that the target is smaller then the origin
    protected boolean isFilled()  

    Methods inherited from class Shapes.MyShape

    draw

    Methods inherited from class java.lang.Object

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

    • filled

      private boolean filled
  • Constructor Details

    • MyBoundedShape

      public MyBoundedShape​(java.awt.Point origin, java.awt.Point target, java.awt.Color color, boolean filled, int thickness)
      makes new compound shape
      Parameters:
      origin - the origin of the shape
      target - the end point of the shape
      color - the color of the shape
      filled - if the shape is filled or outlined
  • Method Details

    • isFilled

      protected boolean isFilled()
    • findStart

      protected java.awt.Point findStart()
      finds the point to start drawing from to allow drawing shapes that the target is smaller then the origin
      Returns:
      a point to start drawing the shape from
    • calculateWidth

      protected int calculateWidth()
      Returns:
      the abs value of the width of the shape
    • calculateHeight

      protected int calculateHeight()
      Returns:
      the abs value of the height of the shape