Homework 1: Graphics - Output
Description
In this homework assignment, you are asked to create a JComponent,
named QuickWrite, that looks like this:
This component should have a dimension of 250 x 250 pixels.
There are two rectangles, which we will refer to as the inner box and
the outer box.
The boxes are divided into 8 active zones, where text can be drawn
it. The text should be drawn as 12 or 14 pt fonts.
The center of the component is a resting zone defined by a circle with
a diameter of 125 pixels.
Because we want to be able to customize the layout of the characters and
symboles in this component, yoiu are asked to draw the characters and symbols
as specified by input files we provide you. i.e, the characters and
symbols drawn inside each of the boxes are changeable values. To
specify these values, we use a notation that looks like the next few
lines:
o[1,1] : a
i[1,1] : `
o[1,2] : s
i[1,2] : ^
o[1,3] : k
o[1,4] : m
i[1,4] : \
o[1,6] : q
The first letter of each line indicates if the character belongs
to the outside box or the inside box.
The numbers indicates where in the box the character should be
painted. The first number indicates which zone it belongs to.
The second number indicates where in that box and zone to draw
the character. For example, the letter 'a' is indicated as o[1,1],
which means the letter 'a' should drawn be at the middle of the outside
box of zone 1. The letter 's' is the next character to the right
from 'a', similar to how zone 2 is the next zone from zone 1 and therefore
denoted as o[1,2]. Likewise since the letter 'q' is two characters
down from the letter 'a', like how zone 6 is two zones down from zone
1, it is denoted as o[1,6].
There are additional String values that can show up in the spec files representing
symbols, for each case your QuickWrite component should draw the actual symbol:
square
circle
up
down
left
right
divide
multiply
Specifications for the character and symbol arrangements are
specified in the following file:
To test that your code works, you can also check it against this
file.
You can use the following Java file to parse the input spec files for you
(if you want).
To use this object, construct it with the name of the input spec file.
Then you may obtain the String describing what information should
be drawn where:
QWMap qwm = new QWMap("hw1-spec_1.txt");
String value = qwm.get('o',2,1); // value returned for
o[2,1] should be "square"
We are providing the file TestFrame.java
which accepts a command line parameter pointing to the file specifying the
text and symbol layout for the QuickWrite component. This TestFrame.java
file will construct a QuickWrite component and adds it to the frame and then
displays the frame. This means your QuickWrite component needs to implement
a constructor that accepts a String argument which is the filename for this
spec file.
Deliverable
Please work on this homework assignment alone; please do not consult
others.
This homework assignment should be done in JAVA, and needs to
be compiled to run using SUN's JDK 1.4 or higher.
Please zip up your source code and mail the zip file to the TA
( khai@cc.gatech.edu
) when you have completed the assignment (and remember to CC yourself on
the email). Please include in the email instructions on how to run
your application.
The due date for this assignment is: August 30, 2002, 12:00 PM EST.