In this homework assignment, you are asked to add the handling of
mouse input to the GUI you built from homework 1, making this component
into a text-entry gesture recognizer.
This recognizer works the following way. A gesture will always
start from the resting zone (the circle at the center of the GUI) and
should be recognized when the mouse return to the resting zone.
A gesture can be for a single letter (such as this gesture for the
letter u).
Or a gesture can be used to input any number of
characters (such as this gesture for the word the).
To input the letter u, the user clicks and holds down the left
mouse button in the resting zone and then enters zone 5 and then comes back
to the resting zone from zone 3. By cross-referencing the zones entered
and exited with the spec file, you should be able to look up the letter
gestured everytime the mouse returns to the resting zone. Recall
that the file specifying where to draw characters on this GUI defines for
the letter u aso[5,3] : u.
The left mouse button does not have to be pressed inside the resting
zone for it to be considered a valid gesture. A valid gesture is
defined as when the mouse exits the resting zone with the left mouse
button held down and returns to the resting zone with the left mouse button
still down. For example, in the following figure, the left mouse
button is clicked and held down in zone 8, then the mouse is moved back
into the resting zone, then zone 5, then zone 3, then returned to the resting
zone and then finally the left mouse button is released. This gesture
is a perfect valid gesture for the letter u.
As a result, after gesturing one letter, the user may continue to gesture
for more without releasing the left mouse button. This is how the
word the was entered: by first gesturing for the letter t,
and without releasing the left mouse button, the user continues to gesture
for the letter h and then e.
Recall that there are a set of special symbols in the interface. These
symbols actually represent special characters or have special commands/functions:
square - when a square is recongized, your component should
toggle to recognizing the next character or symbol from the inside box.
The following gesture toggles the component to recognize from the inner
box and then the character ~ . After the character ~ is recognized,
the component returns to recognized characters or symbols from the outer
box. Even if the gesture after toggling to the inner box mode is not
a successful gesture, the component should toggle back to recognizing characters
and symbols from the outer box.
circle - no-op. Don't do anything. No reason
behind this :-)
up - when selected once acts as a SHIFT for the next letter
('a' - 'z') recognized and then returns to lowercase again, when selected
twice enters CAPS-LOCK mode for all letters ('a' - 'z') entered until the
up symbol is selected again to disable CAPS-LOCK mode. Your interface
should reflect when shift is selected or when it is in CAPS-LOCK mode by
showing the letters in upper case.
becomes
left - backspace is recognized. Output to standard
output "backspace".
right - space is recognized. Output to standard output
"space".
down - newline ("\n") is recognized. Output
to standard output "newline".
Again 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. Please use this TestFrame.java file; i.e., you
code must work with TestFrame.java.
To demonstrate that this tool is work, your code should output the recognized
gestured using System.println's to print when it has recognized some character
(including backspace, space, and newline).
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: September 9, 2002, 12:00
PM EST.