Assignment title: Java
Question
java
Q
You are to write a software application using the Java programming language that enables a user to
design a flag. The user draws circles or ellipses, horizontal or vertical bars on the flag. The user
chooses the colour, width, height and location of the circles, ellipses and / or bars.
The width, height and location are in pixels. The default base flag should be 240 120 pixels, and
of white colour. The top left corner of the flag should be 10 pixels to the right and 10 pixels below
the top left corner of the drawing area. The flag itself should have a black border, but the bars,
circles and ellipses should not.
The default values for the width and distance text boxes for vertical bars should be the flag width / 3
(= 80 pixels). For horizontal bars, the default values for the height and distance text boxes should be
the flag height / 3 (= 40 pixels).
The default values for the circles should be: width = 40 pixels, height = 40 pixels, X distance (from
top-left of flag) = 80 pixels, and Y distance = 20 pixels.
Your task in Part A will be to develop a GUI (using the built-in WindowBuilder in Eclipse and
Java Swing components) that allows a user to input the data for a particular flag. To this end, the
user can
input the data using Java Swing GUI elements, e.g. text fields, radio buttons, drop down
lists, etc.,
draw bars / rectangles and circles / ellipses,
draw combinations thereof as each drawn shape is added to the already existing flag
drawing,
select different colours for each shape to be drawn, and
reset the drawing area back to the default base flag.
The drawing area must have a minimum size of 300 x 200 pixels. The drawing area and the flag
itself should have a clearly visible border, but the flag's bars / rectangles and circles / ellipses not.
The data should be entered through the GUI and visualised when the Draw button is clicked. It
does not need to be saved in Part A, neither in memory (in an array or vector, for example), nor in a
text file. Only the data for one flag at a time needs to be visualised.
The Reset button erases the flag drawing and presents the white base flag with a clearly visible
border again.
The Quit button exits the program.