Package Shapes
Class MyRoundedRectangle
java.lang.Object
Shapes.MyShape
Shapes.MyBoundedShape
Shapes.MyRoundedRectangle
public class MyRoundedRectangle extends MyBoundedShape
a rounded rectangle that draws rectangle width rounded corners
- Author:
- Itay Finci
-
Field Summary
Fields Modifier and Type Field Description (package private) introundnessPercentage -
Constructor Summary
Constructors Constructor Description MyRoundedRectangle(java.awt.Point origin, java.awt.Point target, java.awt.Color color, boolean filled, int roundnessPercentage, int thickness)makes a new rounded rectangle -
Method Summary
Modifier and Type Method Description voiddraw(java.awt.Graphics g)shapes will implement this method to be drawnprivate intlengthPercentage(int length)finds the arc length based on the length and the roundness percentageMethods inherited from class Shapes.MyBoundedShape
calculateHeight, calculateWidth, findStart, isFilled
-
Field Details
-
roundnessPercentage
int roundnessPercentage
-
-
Constructor Details
-
MyRoundedRectangle
public MyRoundedRectangle(java.awt.Point origin, java.awt.Point target, java.awt.Color color, boolean filled, int roundnessPercentage, int thickness)makes a new rounded rectangle- Parameters:
origin- the point which the rectangle starts intarget- the point which the rectangle ends incolor- the color of the rectanglefilled- if the rectangle is filled or notroundnessPercentage- the percentage of the width and height that turns into the arc- between 0 to 100thickness- the line thickness
-
-
Method Details
-
draw
public void draw(java.awt.Graphics g)Description copied from class:MyShapeshapes will implement this method to be drawn -
lengthPercentage
private int lengthPercentage(int length)finds the arc length based on the length and the roundness percentage- Parameters:
length- the width/ height that need to be calculated- Returns:
- the width/ height of the arc
-