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 booleanfilled -
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 intcalculateHeight()protected intcalculateWidth()protected java.awt.PointfindStart()finds the point to start drawing from to allow drawing shapes that the target is smaller then the originprotected booleanisFilled()
-
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 shapetarget- the end point of the shapecolor- the color of the shapefilled- 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
-