Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1: 1- Download the code source of the open source application that you find on the following link: https://github.com/gre/shape-editor., 2- Open the project on

Part 1:
1- Download the code source of the open source application that you find on the following link: https://github.com/gre/shape-editor.,
2- Open the project on an IDE (Eclipse, NetBeans or inttellij...etc),
3- Test the program by running the class Window.java to try the program (see figures
B, C and D) below that show some screen shots of the use of this application),
Part 2:
We want to extend the application in a way that the user could draw a complete picture that contains a rectangle, a circle and a triangle by only one click.
To realize this goal, you are asked to use the composite design pattern (see Fig.A) as follow:
- Rename the existing method called draw(Graphics gx) into drawOriginal(Graphics gx),
- Create a method draw(Graphics gx) in the interface Figure,
- Create a java class Picture that extends the existing interface Figure and that could
be composed of other figures (Rectangle, Triangle, Circle...) that implement the
interface Figure,
- The class Picture will implement the added method draw(Graphics gx),
- In the class Rectangle, Circle, and Triangle (or Polygon) implement the added
method draw(Graphics gx) and choose the dimensions and color that will be used to
draw or fill these graphics,
- Add a JButton in the GUI of the application called drawPicture. When the user clicks
on this button a picture containing three shapes (a Circle, a Triangle and a Rectangle)
will be directly drawn (see Fig.AA).
- The event handling of clicking on the button drawPicture is implemented in the class
Window and in the method actionPerformed the class composite Picture will be instantiated and uses methods add and remove to manipulate the figures that could be added to the composite such as Rectangle, Triangle or Circle.
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
\( \begin{array}{lr}4 G \text { It. } & 6: 52 \\ & \text { project_SWE_423_1038.pdf } \quad ightarrow\end{array} \) urrar winco ne4 4. 1 nec 4GI I. 6:52 project_SWE_423_1038.pdf 5 3 4GI. 6:52 project_SWE_423_1038.pdf 5 2 Proiect (SWF423, Sertion 1038 - ACADEMILC YFAR 4244) Goak: - Analyze an existing java application. - Extend the application by implementing a Composite design pattem Assume that we will perform a reuse task on an existing graphic editor; we will follow the next steps: Part 1: 1. Download the code source of the open source application that you find on the following link: bttpil/sithub. com/gre/stanseditos. 2. Open the project on an IDE (Eclipse, NetBeans or inttelli__etc). 3. Test the program by running the class Window. java to try the program isee figures B,C and D ) below that show some screen shots of the use of this applicationl. Part 2i We want to extend the application in a way that the user could draw a complete picture that contains a rectangle, a circle and a triangle by only one click. To realize this goal, you are asked to use the composhe design pattern (see fic A) as follow: - Rename the existing method called draw(Graphics x ) into drowOriginel|Grephicr gx). - Create a method draw(Graphics gx ) in the interfoce figure, - Create a java class Picture that extends the evisting interface figure and that could be composed of other figures (Rectangle, Triongle, Circle.) thut implement the interface figure, - The class Picture will implement the added method drow/Grophics gel. - In the class Rectangle, Circle, and Triangie (ar Pobgon) implement the adsed method drow|Graphics gx/ and choose the dimensions and color that will be used to draw or filit these graphics, - Add a Jbutton in the GUI of the application called drawPicture. When the user clicls on this button a picture containing three shapes [a Circle, a Triangle and a Rectande] will be directly drawn (see Fig.AA). - The event handling of clickng on the button drawpicture is implemented in the dass Window and in the method actionPerformed the class composite Picture will be instantiated and uses methods add and remove to manipulate the figures that could be added to the composite such as Rectangle, Triangle or Circle

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions