Homework 3: Generating events & FSM

Description

Please note, there are two parts to this homework assignment.

Part 1.

In part 1 of the homework assignment, you are asked to modify your QuickWrite component to dispatch events of type KeyEvent to any KeyListener that registers interest in those events from the QuickWrite component.  You are provided with the files TestFrame.java and JTextBox.java . A JTextBox is a subclass of the JTextArea component available in Swing.  The only difference is that it implements the KeyListener interface.  The TestFrame class now contains multiple instances of the JTextBox component, and the TestFrame class itself now also implements the KeyListener interface and performs a println of each KeyEvent.

To allow KeyListeners to register and unregister interest for KeyEvents generated through your QuickWrite component, it must implement the following methods:
Your QuickWrite component will need to fire a KeyEvent for each recognized gesture to the registered KeyListeners in the following manner:
In the TestFrame.java file provided, only one of the three instances of JTextBox would ever receive the KeyEvent because the JTextBox is a subclass of the JTextComponent class.  The TestFrame however should always receive any KeyEvent generated by the QuickWrite component.

Additionally, the JTextBox has a setDelayTime() method which is used to intentionally slow down the response time of that component when it receives a KeyEvent.  Of the three JTextBox instances contained in the TestFrame, the rightmost JTextBox has a delay time of 2 seconds in response to a KeyEvent it is provided.

You will need to modify your QuickWrite component to remain responsive to user input even though other parts of the application may not be very quick in reacting to input.  For example, when the user clicks in the rightmost JTextBox and begins input text through your QuickWrite component, it should still be able to recognize all the input the user specifies despite the delay in display introduced by that component.  Because the TestFrame is also a registered listener for the KeyEvents generated through your QuickWrite component, it should be receiving it before the slow JTextBox.  Don't worry about it showing up in the JTextBox slowly because that is something we are intentionally slowing down.  Do worry about being able to recognize all the gestures.

Your application MUST be written to work with the given TestFrame.java and JTextBox.java files provided.

Part 2.


Create a finite state machine (FSM) representation of the QuickWrite interactor.

  1. What input events are important to track for this interactor?
  2. What actions performed by the system are important to express for this interactor?
  3. Produce a graphical FSM that accurately portrays the correct behavior of a QuickWrite implementation.  Be sure to check that your FSM describes the expected behavior for ALL possible input events under all relevant preconditions.

Deliverables

Please work on this homework assignment alone; please do not consult others.

Part 1 of 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.

Part 2 of this homework assignment should be turned in on paper in class.

The due date and time for both parts of this assignment is:  September 18, 2002, 9:00 AM EST.