This program is a collection of geometric shapes, implemented in Java and utilizing the JavaFX GUI to display them on a canvas. The program defines a hierarchy of geometric shapes, starting with the abstract class MyShape
which contains all common properties and methods shared by all shapes.
- A hierarchy of geometric shapes:
MyShape
,MyBoundedShape
,MyLine
,MyOval
, andMyRectangle
classes. - Each shape is represented by 4 numbers (x1, y1), (x2, y2) and a color, and can draw itself using the
GraphicsContext
method. - Constructors that take shape's data as input and initialize the variables.
equals
method implemented to compare shapes by length.- Cloneable interface and the
clone
method ofObject
to clone shapes. - Main program creates 2 shapes of each kind with random values of location and size between 0 and 200, all shapes are initialized with the red color.
- Cloned shapes will be moved by x+10 and y+10 and will be green instead of red.
- Displayed on a Canvas inside an Application window in the JavaFX GUI.