In this activity we explore some drawing methods.
We have provided three classes:
When OULogoTest is run it creates an instance of PictureFrame, passing it an instance of OULogo as an argument. A simple line drawing of the Open University logo is produced.

The task is to modify the code, first so that OULogo draws filled areas rather than lines:

and then to extend the drawing code so that a shadow is added:

Note that for simplicity we are working with an earlier version of the university logo and not the one currently in use.
Compile and run the project to see the simple version of the logo. (If you are prompted for a main class set it to ex7_3.OULogoTest).
Update the OULogo class so that instead of drawing the outline of a U shape, the U shape is filled in with colour blue.
Now do the same for the O inside the U, this time in colour yellow.
Recompile and run the project to test your changes. (Hint: For the U, you can draw a filled rectangle with a filled arc at its bottom.)
Create a new class BetterOULogo, which should inherit from OULogo. Write a new paintComponent method which now begins by drawing a dark grey shadow, using exactly the same shapes as the logo but with 10 added to all the x-coordinates and 5 added to the y-coordinates, thus giving a shadow 10 to the right and 5 down from where the logo will appear.
Once the shadow is drawn, the paintComponent method from the superclass OULogo should be invoked. This will draw the logo in front of the shadow as required.
Note that it's essential to do things this way round. Drawing the logo first won't produce the result we want. In a paint method you always need to ensure that methods are invoked in the correct order.
Compile and test the final version.
For our sample solutions see the Solution file.