A04

Due Date: Friday, 5 February 2021
File(s) to be submitted: FlagOne.java, FlagTwo.java, FlagThree.java
Sample Output: SampleOutput.html


SUBMIT   /   Check

More Fun with Flags (GUIs and Inheritance)

Summary

Create three JPanel flags and use the FlagFrame class provided to display them.

FlagFrame.java

The first flag may be just stripes (horizontal or vertical), but the other two must be more interesting.

I have provided two example JPanel flags:

You can see the resulting windows in the sample output.

In order to make sure your code runs when submitted, name the flag classes:

Do not name them after the countries!

Details

The class FlagFrame represents a GUI designed to hold a flag image. You need to put that class into your A04 project, but don't change it (except you may change or delete the package command).

Your task in this assignment is to create three classes that extend JPanel such that each one draws a flag. In order to do that, your class needs to:

See the sample flags for examples of the above.

Notes

For the constructor:

For paintComponent, I would like you to stick to the following methods:

In each of those methods:

To draw in colour, you need to set the colour just before you start drawing the objects.

Note that later objects are drawn over earlier objects, a fact I used in both the sample flags to colour in the central stripe. I made the whole flag the colour of the central stripe, then added to other stripes on top of that colour.

If you're clever, you can use that fact to create a crescent in your flag by drawing one oval on top of another.

Grading Outline

Your assignment will be graded out of 100. Yes, that is well over 100 points of possible deductions. Doing half the job is not going to get you have the credit. You need to do good work as a matter of course; only excellent work will get full credit.
SUBMIT   /   Check